[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Wildcards do not match invalid characters

From: Bruno Haible
Subject: Re: [Bug-tar] Wildcards do not match invalid characters
Date: Fri, 8 Feb 2008 00:02:27 +0100
User-agent: KMail/1.5.4

Sergey Poznyakoff wrote:
> > ... fnmatch() indeed returns -1, which means an
> > error happened and perror() says "Invalid or incomplete multibyte
> > or wide character". ...
> Thanks for reporting. I am not sure what exclude_fnmatch is supposed
> to return on error, since it returns bool, so I'm CC-ing this to
> address@hidden 

Notwithstanding Paul's opinion - exclude_fnmatch is among Paul's code -
I would say that such critical filtering functions like exclude_fnmatch
should not return true or false if there is ambiguity like this. You don't
know whether this would cause files to be archived, not archived, erased, or

Either exclude_fnmatch should signal an error, making 'tar' exit.
Or it should try harder to avoid the error by treating invalid byte sequences
like unknown characters. This is what the 'mbchar' module in gnulib does: it
reads sequences of bytes and transforms them into wchar_t instance where
possible, but keeps the naked uninterpreted byte if there was a conversion
error. With this abstraction, "*" will match "\344" also in an UTF-8 locale.

Any volunteer wants to write a 'mbsfnmatch' function that works like fnmatch
but supports invalid byte sequences?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]