bug in commit 20f6b54385d2462d858419f7c67509cb3d22d155

Andreas Schwab schwab at linux-m68k.org
Mon Mar 26 11:56:22 UTC 2012


Denys Vlasenko <vda.linux-gM/Ye1E23mwN+BqQ9rBEUg at public.gmane.org>
writes:

> Hi Dmitry,
>
>  for file in "$logfile".*; do
>         [ -f "$file" ] || continue
> -       suffix=${file:1+$pfxlen}
> -       [ "$suffix" -gt 0 ] 2> /dev/null || {
> -               echo "Skipped file '$file' (bad suffix)" >&2
> +       suffix=${file#$logfile.}
>
> suffix=${file#$logfile.} is not a good way to strip $logfile prefix:
> ${var#pattern} operation interprets <pattern>, indeed, as glob pattern.

Unless quoted.

> Try this:
>
> logfile="????"
> file=FILE.123
> suffix=${file#$logfile.}
  suffix=${file#"$logfile".}
> echo "$suffix"

> I think we'd better use suffix=${file:1+$pfxlen}.

This is not portable.

Andreas.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




More information about the Strace-devel mailing list