{"action":"created","issue":{"url":"https://api.github.com/repos/gregorio-project/gregorio/issues/868","repository_url":"https://api.github.com/repos/gregorio-project/gregorio","labels_url":"https://api.github.com/repos/gregorio-project/gregorio/issues/868/labels{/name}","comments_url":"https://api.github.com/repos/gregorio-project/gregorio/issues/868/comments","events_url":"https://api.github.com/repos/gregorio-project/gregorio/issues/868/events","html_url":"https://github.com/gregorio-project/gregorio/issues/868","id":131225378,"number":868,"title":"Bug in element determination","user":{"login":"henryso","id":421318,"avatar_url":"https://avatars.githubusercontent.com/u/421318?v=3","gravatar_id":"","url":"https://api.github.com/users/henryso","html_url":"https://github.com/henryso","followers_url":"https://api.github.com/users/henryso/followers","following_url":"https://api.github.com/users/henryso/following{/other_user}","gists_url":"https://api.github.com/users/henryso/gists{/gist_id}","starred_url":"https://api.github.com/users/henryso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryso/subscriptions","organizations_url":"https://api.github.com/users/henryso/orgs","repos_url":"https://api.github.com/users/henryso/repos","events_url":"https://api.github.com/users/henryso/events{/privacy}","received_events_url":"https://api.github.com/users/henryso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gregorio-project/gregorio/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/gregorio-project/gregorio/labels/C","name":"C","color":"fad8c7"},{"url":"https://api.github.com/repos/gregorio-project/gregorio/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-02-04T03:05:40Z","updated_at":"2016-02-05T06:23:22Z","closed_at":null,"body":"I found a major and long-standing bug in the code.  In `gabc-elements-determination.c`, there is this code:\r\n\r\n```\r\n        if (is_puncta_ascendens(current_glyph->type)) {\r\n            current_glyph_type = G_PUNCTA_ASCENDENS;\r\n        } else {\r\n            if (is_puncta_descendens(current_glyph->type)) {\r\n                current_glyph_type = G_PUNCTA_DESCENDENS;\r\n            } else {\r\n                current_glyph_type = current_glyph->type;\r\n            }\r\n        }\r\n```\r\n\r\nThe problem is, `current_glyph_type` is being tested against `gregorio_glyph_type` values but `current_glyph->type` is of type `gregorio_type`, and in this case is *always* `GRE_GLYPH` (which has the same numeric value as `G_2_PUNCTA_INCLINATA_DESCENDENS`).\r\n\r\nSo this code is *unconditionally* setting `current_glyph_type` to `G_PUNCTA_DESCENDENS` before making any further element determination.\r\n\r\nIf I fix this by changing the code to\r\n```\r\n        if (is_puncta_ascendens(current_glyph->u.notes.glyph_type)) {\r\n            current_glyph_type = G_PUNCTA_ASCENDENS;\r\n        } else {\r\n            if (is_puncta_descendens(current_glyph->u.notes.glyph_type)) {\r\n                current_glyph_type = G_PUNCTA_DESCENDENS;\r\n            } else {\r\n                current_glyph_type = current_glyph->u.notes.glyph_type;\r\n            }\r\n        }\r\n```\r\n... it changes **A LOT** of tests.  Do I fix it?\r\n\r\nThis code has literally been doing this since *inception* (see https://github.com/gregorio-project/gregorio/blob/588be00ed31072c8d0c2ef14d382718bdd130ecf/plugins/gabc/gabc-elements-determination.c)."},"comment":{"url":"https://api.github.com/repos/gregorio-project/gregorio/issues/comments/180218315","html_url":"https://github.com/gregorio-project/gregorio/issues/868#issuecomment-180218315","issue_url":"https://api.github.com/repos/gregorio-project/gregorio/issues/868","id":180218315,"user":{"login":"henryso","id":421318,"avatar_url":"https://avatars.githubusercontent.com/u/421318?v=3","gravatar_id":"","url":"https://api.github.com/users/henryso","html_url":"https://github.com/henryso","followers_url":"https://api.github.com/users/henryso/followers","following_url":"https://api.github.com/users/henryso/following{/other_user}","gists_url":"https://api.github.com/users/henryso/gists{/gist_id}","starred_url":"https://api.github.com/users/henryso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henryso/subscriptions","organizations_url":"https://api.github.com/users/henryso/orgs","repos_url":"https://api.github.com/users/henryso/repos","events_url":"https://api.github.com/users/henryso/events{/privacy}","received_events_url":"https://api.github.com/users/henryso/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T06:23:22Z","updated_at":"2016-02-05T06:23:22Z","body":"Based on that premise, I think I can make the `G_ONE_NOTE` thing work.  The code is definitely buggy as my earlier testing showed that previous_glyph can be any glyph that can come after a GRE_SPACE, including another GRE_SPACE.\r\n\r\nHow about `/!` for an interglyph space?"}}