{"action":"created","issue":{"url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/40","labels_url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/40/comments","events_url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/40/events","html_url":"https://github.com/rmyorston/busybox-w32/issues/40","id":71110539,"number":40,"title":"Variable substring matching pattern not recognized","user":{"login":"vszakats","id":1446897,"avatar_url":"https://avatars.githubusercontent.com/u/1446897?v=3","gravatar_id":"","url":"https://api.github.com/users/vszakats","html_url":"https://github.com/vszakats","followers_url":"https://api.github.com/users/vszakats/followers","following_url":"https://api.github.com/users/vszakats/following{/other_user}","gists_url":"https://api.github.com/users/vszakats/gists{/gist_id}","starred_url":"https://api.github.com/users/vszakats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vszakats/subscriptions","organizations_url":"https://api.github.com/users/vszakats/orgs","repos_url":"https://api.github.com/users/vszakats/repos","events_url":"https://api.github.com/users/vszakats/events{/privacy}","received_events_url":"https://api.github.com/users/vszakats/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-04-26T19:39:04Z","updated_at":"2015-05-19T17:44:04Z","closed_at":null,"body":"This script is meant to extract the filename part from a pathspec in a portable way. It's expected to display `file.ext` twice, but it displays the whole input string instead when run with BusyBox:\r\n```bash\r\n#!/bin/sh\r\ntest='/dir/file.ext'\r\necho \"${test##*[/|\\\\]}\"\r\ntest='\\dir\\file.ext'\r\necho \"${test##*[/|\\\\]}\"\r\n```\r\n\r\nBusyBox v1.24.0-TIG-1784-gdb98881 (2015-04-22 21:47:46 BST) multi-call binary:\r\n```\r\n/dir/file.ext\r\n\\dir\\file.ext\r\n```\r\n\r\n3.1.23(6)-release:\r\n```\r\nfile.ext\r\nfile.ext\r\n```\r\n\r\nIt's an upstream issue, in case it isn't an intentional omission. The pattern matching rules are described [here](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13).\r\n"},"comment":{"url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/comments/103611664","html_url":"https://github.com/rmyorston/busybox-w32/issues/40#issuecomment-103611664","issue_url":"https://api.github.com/repos/rmyorston/busybox-w32/issues/40","id":103611664,"user":{"login":"vszakats","id":1446897,"avatar_url":"https://avatars.githubusercontent.com/u/1446897?v=3","gravatar_id":"","url":"https://api.github.com/users/vszakats","html_url":"https://github.com/vszakats","followers_url":"https://api.github.com/users/vszakats/followers","following_url":"https://api.github.com/users/vszakats/following{/other_user}","gists_url":"https://api.github.com/users/vszakats/gists{/gist_id}","starred_url":"https://api.github.com/users/vszakats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vszakats/subscriptions","organizations_url":"https://api.github.com/users/vszakats/orgs","repos_url":"https://api.github.com/users/vszakats/repos","events_url":"https://api.github.com/users/vszakats/events{/privacy}","received_events_url":"https://api.github.com/users/vszakats/received_events","type":"User","site_admin":false},"created_at":"2015-05-19T17:44:04Z","updated_at":"2015-05-19T17:44:04Z","body":"You're right, there is a compromise to make depending on the exact use-case. I'd be personally a bit worried to use backslashes in *nix filenames, even if they are formally valid. Those may test the limits of scripts and tools, similarly to how spaces-in-pathnames may cause all sorts of problems under Windows. If it is under one's control, that is."}}