From owner-freebsd-hackers Sat Jul 11 08:26:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA10506 for freebsd-hackers-outgoing; Sat, 11 Jul 1998 08:26:07 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mail.camalott.com (root@mail.camalott.com [208.203.140.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA10500 for ; Sat, 11 Jul 1998 08:26:05 -0700 (PDT) (envelope-from joelh@gnu.org) Received: from detlev.UUCP (tex-33.camalott.com [208.229.74.33]) by mail.camalott.com (8.8.7/8.8.5) with ESMTP id KAA23588; Sat, 11 Jul 1998 10:26:18 -0500 Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.8) id KAA13574; Sat, 11 Jul 1998 10:25:34 -0500 (CDT) (envelope-from joelh) Date: Sat, 11 Jul 1998 10:25:34 -0500 (CDT) Message-Id: <199807111525.KAA13574@detlev.UUCP> To: tlambert@primenet.com CC: dchapes@ddm.on.ca, rminnich@Sarnoff.COM, hackers@FreeBSD.ORG In-reply-to: <199807110848.BAA16020@usr08.primenet.com> (message from Terry Lambert on Sat, 11 Jul 1998 08:48:16 +0000 (GMT)) Subject: Re: Improvemnet of ln(1). From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <199807110848.BAA16020@usr08.primenet.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>> 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