setup and colons in filenames

Ken Brown
Thu Oct 26 17:04:00 GMT 2017

On 10/26/2017 12:14 PM, Jon Turney wrote:
> On 25/10/2017 20:23, Jon Turney wrote:
>> On 25/10/2017 16:50, Ken Brown wrote:
>>> This is a followup to the thread started here:
>>> Currently setup's parse_filename is not correctly parsing filenames 
>>> in /etc/setup/installed.db that contain colons, as explained in the 
>>> above thread.  It would be easy to fix this by just ripping out the 
>>> 'base' function, except for the fact that parse_filename is called by 
>>> ScanFindVisitor::visitFile.
>> Since older setup cannot correctly parse an installed.db containing 
>> filenames like that, we should probably bump the installed.db version 
>> at the same time as fixing this.
>>> I don't know enough about WIN32_FIND_DATA to know whether the call to 
>>> 'base' is needed for that use of parse_filename.  If so, is it safe 
>>> to skip all colons in that setting, since we're dealing with Win32 
>>> filenames and they don't see the colons in Cygwin filenames?
>> Yeah, that's about as far as I got before giving up...
>>> Do we need two versions of parse_filename, one that calls base and 
>>> one that doesn't?
>> This might be the easiest solution :)
> It gets better:  We only go down the whole route of using 
> ScanFindVisitor::visitFile() from do_from_local_dir() if we couldn't 
> find an .ini file.
> If there's no .ini file found, we look at every package archive and
> parse the version out of the archive filename.
> This seems a really odd thing to do, as we've no idea about the 
> dependencies of these packages, so installing them is unlikely work well.
> Removing all the setup.ini files from my package directory, the good 
> news is that WIN32_FIND_DATA just returns the filename, not a full 
> pathname, so this use of base() isn't needed, either.
> The bad news is that setup then exits (this works ok in 2.882, so 
> something's got broken somewhere...)

What happens is that ScanFindVisitor::visitFile doesn't set various 
attributes of the packages it creates (such as SDesc).  This leads to a 
crash when the SolvableVersion methods (such as SDesc()) return null 
pointers that get dereferenced by PickView.

> I'm kind of tempted to remove this mis-feature.

I agree strongly.  I was about to write an email suggesting the same 
thing when I saw your mail.  Unless you're already working on it, I'll 
be glad to prepare a patch series that does this and also takes care of 
whatever is needed for supporting colons in installed.db


More information about the Cygwin-apps mailing list