r7347 - in trunk/BOOK: . introduction/welcome postlfs/editors

Ag. D. Hatzimanikas a.hatzim at gmail.com
Wed Apr 9 08:28:41 PDT 2008


On Tue, Apr 08, at 02:32 Randy McMurchy wrote:
> ag at linuxfromscratch.org wrote these words on 04/05/08 02:19 CST:
> > Author: ag
> > Date: 2008-04-05 01:19:38 -0600 (Sat, 05 Apr 2008)
> > New Revision: 7347
> > 
> > Modified:
> >    trunk/BOOK/general.ent
> >    trunk/BOOK/introduction/welcome/changelog.xml
> >    trunk/BOOK/postlfs/editors/ed.xml
> > Log:
> > Replaced with symlinks the hard links to red and its man page
> 
> Why was this done?
> 
> I'm not really in favor of changing author's code unless there is
> really a reason to do it (makes something better, or fixes a problem).
>

I am not either, but this seems a case for an unnecessary hard link
(unless I am missing something obvious, so feel free to be pedantic).

We are just talking here about:

a. The same man page (ed.1), which is hard-linked to red.1 for unknown
   reason.
b. The same executable (ed), which is hard-linked to red (for me for
   unknown/dubious benefit).

But lets examine the latter and test if red works the way it have to, by
just create a symbolic link from ed to red. The man page is out of
question, it hasn't to be a hard-link.

============================================================
[ag][627](~t)which red     
/usr/bin/red
[ag][628](~t)file =red
/usr/bin/red: symbolic link to `ed'
[ag][629](~t)pwd
/tmp
[ag][630](~t)touch test.txt
[ag][631](~t)ed test.txt -s <<< $'i\nThis is\na test\n.\n,p\n,w'
This is
a test
[ag][632](~t)echo $?
0
[ag][633](~t)red test.txt -s <<< $'$a\nThis is \nanother test\nfor red\n.\n,p\n,w' 
This is
a test
This is 
another test
for red
[ag][634](~t)echo $?
0
[ag][635](~t)mkdir test && mv -v test.txt test 
`test.txt' -> `test/test.txt'
[ag][636](~t)red test/test.txt -s <<< $'$a\nLets test if it \nworks\n.\n,p\n,w' 
?
[2]ag][637](~t)echo $?
2
============================================================

So it works the way it is supposed to work (by denying to edit the file),
because that file is in a different directory than $(pwd), as red is a
restricted ed.
It just works that way, when you just invoke it as red.


This is the same case with rvim/rview/gvim and many other applications, see:

[ag][638](~t/test)ll /usr/bin/rv*
lrwxrwxrwx 1 root root 3 2008-02-20 21:26 /usr/bin/rview -> vim*
lrwxrwxrwx 1 root root 3 2008-02-20 21:26 /usr/bin/rvim -> vim*


Finally, I've had a look what other distributions do, and they all do 
symbolic links.

I hope I covered the case, as it seemed to me so obvious when I fixed it, 
that it didn't deserve a discussion or a ticket.

-- 
http://wiki.linuxfromscratch.org/blfs/wiki/Hacking



More information about the blfs-book mailing list