delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/07/14/16:45:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <4B8A0478615FD3118F1600508B0BB71B02F61ACA@pusd-mail.pusd.org>
From: "Mellem, Dan" <Dan DOT Mellem AT pomona DOT k12 DOT ca DOT us>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: RE: Problem with dereference option on Windows LNKs (shortcuts)
Date: Mon, 14 Jul 2003 13:43:54 -0700
MIME-Version: 1.0

From: Igor Pechtchanski On: 7/12/03 6:05 PM

On Sat, 12 Jul 2003, Dan Mellem wrote:

>> Hi,
>>
>> I have a folder that's full of shortcuts to other files (called
>> 'shortcuts'). I'd like to interact with the original files instead of
>> the shortcut (.lnk) files. Basically, if the shortcut is created from
>> within CYGWIN (ln -s [whether CYGWIN=nowinsymlinks or winsymlinks]),
the
>> command:
>>
>> $ cp -LR shortcuts/ shortcuts2/
>>
>> will copy the original files (dereferencing the symbolic links).
>> However, if the shortcut was created in MS-Windows, all I get is a
copy
>> of the shortcuts. The only difference between the MS LNKs and the
[...]
>Cygwin symlinks are a bit more than read-only shortcut (.lnk) files.
>They have a special format, and they also have something in their
>"Comment" field (that you can check via shortcut properties).  In short,
>you cannot easily create a Cygwin symlink from outside Cygwin.  For
>exact details, see the source of the symlink() function in
>winsup/cygwin/path.cc.
>	Igor

Thanks, Igor. I thought that since it created MS-Windows-compatable .LNKs,
it also read regular .LNKs and used them as symlinks.

I took a look at the source
(http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/path.cc?cvsr
oot=src) but didn't find anything specific that said that they aren't
treated as symlinks. I'm not familiar with the source but there was a
section:

      /* Windows shortcuts are treated as symlinks. */
      if (suffix.lnk_match ())
	sym_check = 1;
[...]
      if (sym_check > 0 && opt & PC_CHECK_EA &&
	  (res = get_symlink_ea (suffix.path, contents, sizeof (contents)))
> 0)
	{
	  pflags = PATH_SYMLINK;
	  if (sym_check == 1)
	    pflags |= PATH_LNK;
	  debug_printf ("Got symlink from EA: %s", contents);
	  break;
	}

      /* Open the file.  */


I don't know what this all means but it implies to me that it will at least
attempt to read the shortcut file. Is it possible to parse through regular
shortcut files too?

Thanks again.

-Dan

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019