symlink_info & suffix_scan

Conrad Scott
Thu Jul 4 13:26:00 GMT 2002

I don't fully understand what this code is doing but I've managed
to convince myself that it's not doing the right thing :-)

In, symlink_info::check() constructs a suffix_scan object
and then calls the suffix_scan::next() method repeatedly.  If you
stat(2) a non-existent file *without a suffix* (e.g. ls -L
nonexistent), the suffix_scan object gives the following results:

path = nonexistent,         lnk_match() = false
path = nonexistent.exe,     lnk_match() = false
path = nonexistent.exe,     lnk_match() = true
path = nonexistent.exe.lnk, lnk_match() = true
path = nonexistent.lnk,     lnk_match() = true

The issue is that it gives the path "nonexistent.exe" twice, once
with and once without lnk_match() being true.  AFAICT it should
either give "nonexistent.exe" once (without lnk_match() being
true) or it should *also* give "nonexistent" *with* lnk_match()

Actually, I'm pretty sure that lnk_match() should only be true for
Windows shortcuts (i.e. for files of the form "*.lnk") and so
"nonexistent.exe" should only be given once.

I realise that this is probably not a high priority issue and
unlikely to be causing a problem, but since I stumbled over it (in
pursuit of something else entirely) I thought I'd bring it to the
attention of someone who might have more of a clue than me.


// Conrad

More information about the Cygwin-developers mailing list