[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quoting conversion: `...' to '...'
From: |
Jim Meyering |
Subject: |
Re: quoting conversion: `...' to '...' |
Date: |
Mon, 09 Jan 2012 22:01:31 +0100 |
Jim Meyering wrote:
> Here are some change-sets to convert most `...' quoting to '...'.
>
> I tried to automate as much as possible.
> The commits labeled "maint:..." will be merged into the preceding
> ones since they usually just denote "run the same command again".
>
> Here are the summaries.
> When there is an itemized file list in the ChangeLog,
> it usually means I made manual changes.
I committed these 9:
commit 3ba8b044267a5f7cfa8a7b0d7f19dab3f21431da
Author: Jim Meyering <address@hidden>
Date: Sun Jan 8 21:03:22 2012 +0100
maint: src/*.[ch]: convert more `...' to '...'
Run this (twice):
git grep -E -l '`.+'\' src/*.[ch] \
|xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
commit a517386f1bf8c64ee7617cc2c9d0a16a1d85c8c4
Author: Jim Meyering <address@hidden>
Date: Sun Jan 8 15:08:30 2012 +0100
maint: src/*.c: change remaining quotes (without embedded spaces)
Run this (twice):
git grep -E -l '`[^ ]+'\' src/*.c \
|xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
commit 9af0dced5a2eb167ec7b9dfe3f358f214e45d41a
Author: Jim Meyering <address@hidden>
Date: Sun Jan 8 14:08:03 2012 +0100
maint: convert `...' to '...' in --help output
All affected lines end with \ or \n\, so run this command
until it produces no new changes (4 times):
git grep -E -l '`[^ ]+'\''.*\\' src \
|xargs perl -pi -e 's/`([^ ]+'\''.*\\)/'\''$1/'
commit 36b9a1b6ac2730e78c14552fd55795fe10862a3d
Author: Jim Meyering <address@hidden>
Date: Sat Jan 7 18:30:14 2012 +0100
maint: adjust quoting: emit '...', not `...' in diagnostics
* src/csplit.c (parse_repeat_count, extract_regexp): As above.
* src/date.c (main): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/od.c (decode_one_format, main): Likewise.
* src/pathchk.c (no_leading_hyphen): Likewise.
* src/pr.c (main, getoptarg): Likewise.
* src/rm.c (diagnose_leading_hyphen): Likewise.
* src/sort.c (key_warnings, incompatible_options, main): Likewise.
* src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic.
* src/test.c (main): Likewise.
* src/touch.c (main): Likewise.
* src/tr.c (build_spec_list, validate, append_range): Likewise.
* tests/misc/mktemp: This is an unusual case, since the affected
string contains only the ` of an `...' string. So we change
the long ` to a lone '.
* tests/pr/pr-tests: Manual quote adapting fix-up.
* tests/ln/hard-to-sym: Likewise.
* tests/split/suffix-length: Likewise.
* tests/mv/part-fail: Likewise.
* tests/misc/chcon: Likewise.
* tests/misc/stat-printf: Likewise.
commit ae2b0d2ddca458eb282bb0458987e75e1875a659
Author: Jim Meyering <address@hidden>
Date: Sat Jan 7 20:55:10 2012 +0100
tests: more automated quote adjustment
Relax initial regexp to match more instances, but add a
filter to avoid some invalid conversions. Run this:
git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \
-e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \
-e ' s/\`([^'\''"]*?'\'')/'\''$1/g'
The last disjunct in the above (...) filter is to exempt
any line that contains this string: '\''
With quoting like that, converting a ` to ' is likely to cause trouble,
so we'll handle those manually. Here are three examples where
the exemption is required:
*': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
printf 'creating file `%s'\''\n' $f
'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
commit dd0e4c5621ca2fa9255aef4eee0e7cf41cd335d2
Author: Jim Meyering <address@hidden>
Date: Sat Jan 7 17:47:58 2012 +0100
tests: change `...' to '...' on lines not matching /[=\$]/
Exempt lines with '$' or '=', since those are prone to improper
conversion. Run this:
git grep -l "\`[^']*'" tests \
|xargs perl -pi -e '/[=\$]/ and next;s/\`([^'\''"]*?'\'')/'\''$1/g'
commit 50610144b02763f5dd5f6198ceceb88c27c393aa
Author: Jim Meyering <address@hidden>
Date: Sat Jan 7 17:43:50 2012 +0100
tests: adjust \`...' quoting to '...' to adapt to latest gnulib
Run this:
git grep -l "\\\\\`[^']*'" tests \
|xargs perl -pi -e 's/\\\`(.*?'\'')/'\''$1/g
commit 68a959262aefc5377f5a654d72e71dd42376183e
Author: Jim Meyering <address@hidden>
Date: Sat Jan 7 17:23:17 2012 +0100
build: update gnulib submodule to latest (quoting change)
This pulls in changes to the quote and quotearg modules that
render quoted strings in diagnostics. `Old' vs 'new'.
commit 84e742fab42ac270a1cbc548d4a6f6ac82c8124a
Author: Jim Meyering <address@hidden>
Date: Mon Jan 9 21:33:37 2012 +0100
maint: prep for global quoting changes: handle irregular cases manually
* src/chroot.c (usage): Change ``...'' to '...', and describe the
default more accurately (also adding quotes): s,/bin/sh,'/bin/sh -i',
* src/join.c (usage): Change ` ...'' ' to "...''".
* src/fmt.c (isopen): Change `' to '` in list of bytes, so that
a subsequent change can safely perform the `...' to '...' conversion.
* src/truncate.c (main): Tweak quoting in comments to use '...',
not `...`, for consistency with the rest of comments in coreutils.