Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jul 1998 10:25:34 -0500 (CDT)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        tlambert@primenet.com
Cc:        dchapes@ddm.on.ca, rminnich@Sarnoff.COM, hackers@FreeBSD.ORG
Subject:   Re: Improvemnet of ln(1).
Message-ID:  <199807111525.KAA13574@detlev.UUCP>
In-Reply-To: <199807110848.BAA16020@usr08.primenet.com> (message from Terry Lambert on Sat, 11 Jul 1998 08:48:16 %2B0000 (GMT))
References:   <199807110848.BAA16020@usr08.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>>> I've many times used ln(1) to create what you call 'questionable links'
>>> on purpose and I'd _hate_ warnings.
>> You frequently link to files that don't exist?  I generally consider
>> that to be putting the cart before the cat(1), er, horse.  But it's
>> your system.
> I don't do it frequently, but yes, I do this occasionally.

Then occasionally getting a warning wouldn't be a bad thing.

>>> If someone insists on adding such warnings then do it like mv(1) and
>>> cp(1) by adding an option to ln(1) turn it on.
>> You mean, in the style of the cp and mv which both sport -f, and one
>> of which features the -R flag?
> The "-f" flag to "ln" unlinks an existing file of the link name;
> in other words, it's already taken as "force".
> It would be a mistake to issue a warning without some way to disable
> it, akain to the "rm -f" behaviour of "-f".
> One problem here is that it is likely that you waould want to *not*
> get the "ln -f" behaviour, yet you would want to suppress warnings.

I agree.  So choose a different flag than -f.

>> Bottom line: Warnings are good program design.  Requiring extra work
>> to issue them-- particularly when they're most frequently required in
>> interactive use-- is not.
> Clearly, you could wrap this with a script that uses test(1) to ensure
> the link target exists, and put your script in your path ahead of the
> ln command.

Yes, you could.  I do that quite frequently.  (You can imagine my
~/hp9000-hpux/bin directory, full of compatibility scripts.)  But is
this a problem that only exists for a few users and would annoy many
(which would mean that we few should use the scripts), or does it
exist for many and would annoy few (which would mean we should modify
ln)?

> Whereas in order to get the existing non-"-f" behaviour, I'd have to
> modify existing code.

A warning message wouldn't break your existing code.  Again, we're not
proposing a prompt here, just a diagnostic that you can ignore if
you're intentionally linking to a non-existant file.

> Note that "-f" is already taken on "ln", according to POSIX semantics,
> so it's not like you could overload it reasonably.

Okay, let's choose a different flag.  How about '-q' (quiet)?

Happy hacking,
joelh

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807111525.KAA13574>