Bug introduced by commit v1.11-403-gc47667f, "ylwrap: various refactorings, few improvements", when the `dirname_' function was introduced.
* lib/ylwrap (dirname_): Renamed ... (strip_nondir): ... to this, and make sure that any trailing `/' is kept. * tests/yacc-line.test: Update. --- ChangeLog | 11 +++++++++++ lib/ylwrap | 10 +++++----- tests/yacclex-line.test | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc9ffc3..ffa1616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-05-12 Stefano Lattarini <stefano.lattar...@gmail.com> + ylwrap: bugfix in postprocessing of "#line" directives + Bug introduced by commit v1.11-403-gc47667f, "ylwrap: various + refactorings, few improvements", when the `dirname_' function + was introduced. + * lib/ylwrap (dirname_): Renamed ... + (strip_nondir): ... to this, and make sure that any trailing `/' + is kept. + * tests/yacc-line.test: Update. + +2011-05-12 Stefano Lattarini <stefano.lattar...@gmail.com> + ylwrap: bugfix in postprocessing of "#..." C directives Bug introduced by commit v1.11-413-geab64df, ``ylwrap: move "update if changed" logic out of `handle_renaming'`` diff --git a/lib/ylwrap b/lib/ylwrap index 58541da..e5d17b1 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -44,11 +44,11 @@ quote_for_sed () printf '%s\n' "$1" | sed -e 's/[].[^$\\*|]/\\&/g' } -# For system that lacks a dirname command, we simulate it with sed. -dirname_ () +# Strip trailing non-directory component (if any) from the given path, +# preserving trailing `/' characters in the directory components. +strip_nondir () { - dirname "$1" 2>/dev/null \ - || printf '%s\n' "$1" | sed -e 's,\([\\/]\)[^\\/]*$,\1,' + printf '%s\n' "$1" | sed -e 's,\([\\/]\)[^\\/]*$,\1,' } # Turn the given string into a suitable C preprocessor symbol. @@ -244,7 +244,7 @@ cd "$ocwd" || exit 1 test $ret -eq 0 || eval "$do_exit" # The directory holding the input. -input_dir=`dirname_ "$input"` +input_dir=`strip_nondir "$input"` # Quote $input_dir so we can use it in a regexp. input_rx=`quote_for_sed "$input_dir"` diff --git a/tests/yacclex-line.test b/tests/yacclex-line.test index 2f8765a..c59e5e1 100755 --- a/tests/yacclex-line.test +++ b/tests/yacclex-line.test @@ -89,6 +89,8 @@ for vpath in : false; do $EGREP '#.*(y\.tab|lex\.yy)' foobar.c zardoz.c zardoz.h && Exit 1 grep "^$ws*#.*line$ws.*foobar\\.l" foobar.c grep "^$ws*#.*line$ws.*zardoz\\.y" zardoz.c + grep "#.*\"/foobar\\.l" foobar.c && Exit 1 + grep "#.*\"/zardoz\\.y" zardoz.c && Exit 1 cd $srcdir done -- 1.7.2.3