public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Cast <jcast@ou.edu>
To: Randall R Schulz <rrschulz@cris.com>
Cc: cygwin@cygwin.com
Subject: Re: gzip.exe as symlink breaks NTEmacs's jka-compr.el
Date: Thu, 18 Jul 2002 17:08:00 -0000	[thread overview]
Message-ID: <200207181839.g6IIdcb18988@d-ip-129-15-78-125.cs.ou.edu> (raw)
In-Reply-To: Message from Randall R Schulz <rrschulz@cris.com> of "Tue, 16 Jul 2002 20:15:12 PDT." <5.1.0.14.2.20020716195407.0205cf20@pop3.cris.com>

Randall R Schulz <rrschulz@cris.com> wrote:
> Jon,
<snip>
> >I *think* I follow.  Of course, on Unix, symlinks /are/ aliases, so
> >the problem doesn't arise.

> No. Symlinks are indirections or pointers. The symlink is a distinct
> kind of file system entity and is always distinguishable from the
> original. With hard links each one is completely co-equal with the
> others and there's no such thing as the "real" file vs. the
> link. The latter is what I mean by "alias." This distinction between
> symlinks and hard links is equally applicable to Unix as it is to
> Cygwin, even though Cygwin symlinks are (nowadays) built upon
> Windows shortcuts.

This seems to be an issue of semantics: what does ``alias'' mean (see
below).

> The reason the problem doesn't occur on Linux, Unix or AIX (etc.) is
> that there is no environment or context in which an exec of a
> symlink fails (assuming, that is, that the symlink's target exists
> and is really executable). This is not true under Windows, where
> Windows itself will not follow a shortcut when carrying out it's
> equivalent of the "exec" system call.

Right.  On Unix, all of the system calls that succeed on a regular
(hard-linked) file succeed on a symlink and de-reference it.  So,
programs that aren't looking for symlinks won't notice them.  Not
technically an alias, but close enough.  Of course, on Windows major
system calls (CreateFile, CreateProcess, etc.) don't de-reference
Cygwin symlinks.  So, they're as good pseudo-aliases on Cygwin as on
Unix, but not on Windows.

<snip>
> >Actually, there is an (amortized) smaller way than copying the
> >files.  If the following program is compiled under Cygwin:

> >#include <unistd.h>

> >int
> >main (int argc, char **argv)
> >{
> >         execv ("/bin/gzip", argv);
> >}

> >It should do the same job as a symlink to /bin/gzip under both
> >Cygwin and Windows.  It's slightly less time-and-process efficient,
> >but if space is a concern it's probably better.  I don't have easy
> >access to a Cygwin box just at the moment, but on GNU/Linux (Redhat
> >7.3, to be precise) it's < 3k stripped.  A lot more than a symlink
> >(although I think Windows' filesystem granularity is higher than
> >that anyway), but less than just about any of the programs you
> >list.

> That is a viable alternative, and it is compact and universal, but
> it would make Cygwin building or packaging even more of a horse of a
> different color than it it already is.

Right.  I think you could argue supporting CreateProcess is the same
sort of job as supporting text mounts: tedious but worth-while.

> There's a directly analogous shell script that does essentially the
> same thing, too:

> -==--==--==--==--==-
> #!/bin/sh
>
> exec /bin/gzip "$@"
> -==--==--==--==--==-

It's not ``essentially'' the same thing.  First, it's incorrect, even
on Cygwin.  The reason for symlinking gzip (at least) is so that gzip
will check argv[0], find out it's "gunzip", and de-compress by
default.  So any symlink replacement needs to pass "gunzip" or some
such as argv[0].  The correct way to do this in shell is:

#! /bin/sh

exec -a "$0" /bin/gzip "$@"

However, it won't solve the problem at hand, which is supporting
CreateProcess: I don't think CreateProcess understand #!s :)

> > > I know that if one just uses the "ln" command (no "-s" option)
> > > on a FAT volume you get a copy. If Cygwin packages used hard
> > > links for program aliases (does the TAR format support hard
> > > links?)

> >Yes.

> > > and Setup.exe was given the same smarts as the "ln" command,
> > > you'd get space-wasting copies on FAT volumes and fast,
> > > space-efficient hard links on NTFS.

> >This is a good idea if space on FAT volumes is not a concern.

> Well, we used to regularly see complaints on the list about
> excessive disk consumption when the default install was all
> packages. Now that it's not, those complaints have been replaced
> with complaints of packages or programs being missing (when in fact
> the "missing" packages or programs simply were not installed).

You can't satisfy everyone on a list like this, especially when half
the posters seem to think they've a right to be satisfied :) By ``a
concern'' I meant ``the Cygwin maintainers care about this''.

> >Jon Cast

> Randall Schulz

Jon Cast

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

  reply	other threads:[~2002-07-18 18:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-15  2:20 Matt Swift
2002-07-15  2:26 ` Robert Collins
2002-07-15  5:36   ` gzip.exe as symlink Max Bowsher
2002-07-15  5:38     ` Robert Collins
2002-07-15 12:41       ` Jon Cast
2002-07-15 14:47         ` Nicholas Wourms
2002-07-15 15:57         ` Robert Collins
2002-07-15 22:22       ` Max Bowsher
2002-07-15  9:21     ` Dario Alcocer
2002-07-15 12:02   ` gzip.exe as symlink breaks NTEmacs's jka-compr.el Jon Cast
2002-07-15 17:05   ` Gerrit P. Haase
2002-07-16  8:59   ` Matt Swift
2002-07-16  9:14     ` David Starks-Browning
2002-07-16  9:17       ` Nicholas Wourms
2002-07-16 10:21     ` Randall R Schulz
2002-07-16 19:27       ` Jon Cast
2002-07-16 19:43         ` Randall R Schulz
2002-07-16 19:51           ` Jon Cast
2002-07-16 20:12             ` Randall R Schulz
2002-07-16 20:14               ` Robert Collins
2002-07-16 23:05                 ` Randall R Schulz
2002-07-16 23:42                   ` Robert Collins
2002-07-17  0:53                     ` Randall R Schulz
2002-07-17  0:58                     ` Christopher Faylor
2002-07-17  0:59                       ` Robert Collins
2002-07-16 20:36               ` Jon Cast
2002-07-16 23:54                 ` Randall R Schulz
2002-07-18 17:08                   ` Jon Cast [this message]
2002-07-16 19:49         ` Nicholas Wourms
2002-07-16 19:52           ` Jon Cast
2002-07-15 15:46 gzip.exe as symlink Robinow, David
2002-07-15 15:48 ` Nicholas Wourms
2002-07-16 18:51   ` Jon Cast
2002-07-16 18:50 files and directories distinction: Aldi Kraja
2002-07-16 19:34 ` Randall R Schulz
2002-07-16 19:37   ` Jon Cast
     [not found] <rrschulz@cris.com>
2003-03-29  4:00 ` Mozilla 1.3 built on cygwin? Jeff.Hodges

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200207181839.g6IIdcb18988@d-ip-129-15-78-125.cs.ou.edu \
    --to=jcast@ou.edu \
    --cc=cygwin@cygwin.com \
    --cc=rrschulz@cris.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).