Re: [PATCH v6 00/11] Fix icase grep on non-ascii
Junio C Hamanowrites: > I think somebody's implementation of "echo" is not POSIX kosher. Oops, I misspoke. s/POSIX/XSI/; obviously. But the conclusion is the same. echo '\\\tA' may say \\\tA or backslash HT A, depending on the system, so we cannot rely on that in tests that are meant to be portable. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Wed, Jun 22, 2016 at 11:41 AM, Duy Nguyenwrote: > On Wed, Jun 22, 2016 at 8:36 PM, Junio C Hamano wrote: >> On Wed, Jun 22, 2016 at 11:29 AM, Duy Nguyen wrote: >>> >>> Can any shell wizards explain this to me? With this code >>> >>> BS=\\ >>> echo ${BS}${BS} >>> >>> Debian's dash returns a single backslash while bash returns two >>> backslashes. Section 2.2.1 [1] does not say anything about one >>> backslash (hidden behind a variable!) after escaping the following one >>> and still eats the one after that.. >>> >>> [1] http://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html >> >> I am not a wizard, but is the difference between the shell syntax, or just >> their >> implementation of builtin-echo? IOW, how do these three compare? >> >> printf "%s\n" "${BS}${BS}" >> echo "${BS}${BS}" >> echo ${BS}$BS} > > Great! printf shows two backslashes while both echo'es show one. > printf "" behaves like echo though. Doesn't matter, at least I > should be able to make the tests work on Debian dash. I think somebody's implementation of "echo" is not POSIX kosher. According to http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html you should expect a single backslash. If a script depends on seeing two, the script is buggy. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Wed, Jun 22, 2016 at 8:36 PM, Junio C Hamanowrote: > On Wed, Jun 22, 2016 at 11:29 AM, Duy Nguyen wrote: >> >> Can any shell wizards explain this to me? With this code >> >> BS=\\ >> echo ${BS}${BS} >> >> Debian's dash returns a single backslash while bash returns two >> backslashes. Section 2.2.1 [1] does not say anything about one >> backslash (hidden behind a variable!) after escaping the following one >> and still eats the one after that.. >> >> [1] http://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html > > I am not a wizard, but is the difference between the shell syntax, or just > their > implementation of builtin-echo? IOW, how do these three compare? > > printf "%s\n" "${BS}${BS}" > echo "${BS}${BS}" > echo ${BS}$BS} Great! printf shows two backslashes while both echo'es show one. printf "" behaves like echo though. Doesn't matter, at least I should be able to make the tests work on Debian dash. -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Wed, Jun 22, 2016 at 11:29 AM, Duy Nguyenwrote: > > Can any shell wizards explain this to me? With this code > > BS=\\ > echo ${BS}${BS} > > Debian's dash returns a single backslash while bash returns two > backslashes. Section 2.2.1 [1] does not say anything about one > backslash (hidden behind a variable!) after escaping the following one > and still eats the one after that.. > > [1] http://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html I am not a wizard, but is the difference between the shell syntax, or just their implementation of builtin-echo? IOW, how do these three compare? printf "%s\n" "${BS}${BS}" echo "${BS}${BS}" echo ${BS}$BS} -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Sat, Jun 18, 2016 at 2:26 AM, Duy Nguyenwrote: > On Sat, Jun 18, 2016 at 6:17 AM, Junio C Hamano wrote: >> Nguyễn Thái Ngọc Duy writes: >> >>> v6 fixes comments from Ramsay and Eric. Interdiff below. >> >> Another thing I noticed with this is that the non-ascii test breaks >> when run under dash (but passes under bash). You need to have is_IS >> locale on the system to see the breakage, it seems (which is why I >> didn't see it so far). > > Is it a special version, maybe from debian? It works for me on gentoo. > >> ~/w/git/temp/t $ equery --quiet list dash > app-shells/dash-0.5.8.2 >> ~/w/git/temp/t $ dash ./t7812-grep-icase-non-ascii.sh > # lib-gettext: Found 'is_IS.utf8' as an is_IS UTF-8 locale > # lib-gettext: Found 'is_IS.iso88591' as an is_IS ISO-8859-1 locale > ok 1 - setup > ok 2 - grep literal string, no -F > ok 3 - grep pcre utf-8 icase > ok 4 - grep pcre utf-8 string with "+" > ok 5 - grep literal string, with -F > ok 6 - grep string with regex, with -F > ok 7 - pickaxe -i on non-ascii > # passed all 7 test(s) > 1..7 Can any shell wizards explain this to me? With this code BS=\\ echo ${BS}${BS} Debian's dash returns a single backslash while bash returns two backslashes. Section 2.2.1 [1] does not say anything about one backslash (hidden behind a variable!) after escaping the following one and still eats the one after that.. [1] http://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Sat, Jun 18, 2016 at 6:17 AM, Junio C Hamanowrote: > Nguyễn Thái Ngọc Duy writes: > >> v6 fixes comments from Ramsay and Eric. Interdiff below. > > Another thing I noticed with this is that the non-ascii test breaks > when run under dash (but passes under bash). You need to have is_IS > locale on the system to see the breakage, it seems (which is why I > didn't see it so far). Is it a special version, maybe from debian? It works for me on gentoo. > ~/w/git/temp/t $ equery --quiet list dash app-shells/dash-0.5.8.2 > ~/w/git/temp/t $ dash ./t7812-grep-icase-non-ascii.sh # lib-gettext: Found 'is_IS.utf8' as an is_IS UTF-8 locale # lib-gettext: Found 'is_IS.iso88591' as an is_IS ISO-8859-1 locale ok 1 - setup ok 2 - grep literal string, no -F ok 3 - grep pcre utf-8 icase ok 4 - grep pcre utf-8 string with "+" ok 5 - grep literal string, with -F ok 6 - grep string with regex, with -F ok 7 - pickaxe -i on non-ascii # passed all 7 test(s) 1..7 -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
Nguyễn Thái Ngọc Duywrites: > v6 fixes comments from Ramsay and Eric. Interdiff below. Another thing I noticed with this is that the non-ascii test breaks when run under dash (but passes under bash). You need to have is_IS locale on the system to see the breakage, it seems (which is why I didn't see it so far). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 00/11] Fix icase grep on non-ascii
On Fri, Feb 5, 2016 at 9:02 PM, Nguyễn Thái Ngọc Duywrote: > v6 fixes comments from Ramsay and Eric. Interdiff below. The only > thing to add is, I decided not to replace !icase_non_ascii with > icase_ascii_only. I went with spelling out "!icase || ascii_only". I > think it expresses the intention better. v6 appears to address all the comments raised in my v5 review. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html