Subject: Re: pkg_add and single quote in filenames
To: =?ISO-8859-15?Q?Joachim_K=F6nig?= <him@online.de>
From: Roland Illig <rillig@NetBSD.org>
List: tech-pkg
Date: 08/24/2007 09:24:30
Joachim König wrote:
> I've created a package that installs files that contain a ' (single quote)
> in the filename.
> 
> pkg_add however has the following code in extract.c:
> 
>>                                 if (strrchr(p->name, '\'')) {
>>                                         cleanup(0);
>>                                         errx(2, "Bogus filename 
>> \"%s\"", p->name
>> );
>>                                 }
> 
> Consequently, a binary package install aborts in such a case.
> 
> I do not want to modify the package to install the files under a different
> name because I would then have to modify an other package that looks
> them up under the given name.
> 
> What's so special about the single quote in a filename, that pkg_add
> handles it so ungracefully and aborts the installation?

Probably the original authors of that piece of software didn't trust 
themselves enough to properly quote all filenames when they are passed 
to the shell, so they restricted them.

This check may be removed in the future, after we have thoroughly 
checked that the pkg_* tools don't create shell commands with unquoted 
filenames.

Roland