Opened 14 years ago

Closed 14 years ago

#5802 closed bug (fixed)

catattr attempts to pull data from symlink's target

Reported by: mmadia Owned by: nobody
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

hrev36458-2hybrid @ trunk.

While researching _packages_/, I noticed that catattr and addattr operate on the symlink targets & not the symlinks themselves. This makes it impossible for a symbolic link to contain attributes.

catattr note: /b2 is a mounted R5 Pro Gobe CD. /BeOS_Tools/ does not exist.

/b2/_packages_> 
/b2/_packages_> ls -lh
total 32K
drwxr-xr-x 1 user root 2.0K Apr  6  2000 Development
drwxr-xr-x 1 user root 2.0K Apr  6  2000 Experimental
lrwxrwxrwx 1 user root   15 Mar 24  2000 GNU Sources -> /BeOS_Tools/GNU
drwxr-xr-x 1 user root 2.0K Apr  6  2000 Japanese
drwxr-xr-x 1 user root 2.0K Apr  6  2000 Media
drwxr-xr-x 1 user root 2.0K Apr  6  2000 Trial Applications
-rw-r--r-- 1 user root    0 Apr  6  2000 _do_not_install_
drwxr-xr-x 1 user root 2.0K Apr  6  2000 us_english
/b2/_packages_> ls /BeOS_Tools
ls: cannot access /BeOS_Tools: No such file or directory
/b2/_packages_> listattr GNU\ Sources 
File: GNU Sources
        Type       Size  Name                                
----------------------------------------------------------
        Text        12  "INSTALLER PACKAGE: NAME"
        Text        47  "INSTALLER PACKAGE: DESCRIPTION"
        Text         8  "INSTALLER PACKAGE: GROUP"
      'OFFT'         8  "INSTALLER PACKAGE: SIZE"
     Boolean         1  "INSTALLER PACKAGE: ON_BY_DEFAULT"
     Boolean         1  "INSTALLER PACKAGE: ALWAYS_ON"
 MIME String        31  "BEOS:TYPE"
    Raw Data        20  "_trk/pinfo_le"

128 bytes total in attributes.
/b2/_packages_> catattr "INSTALLER PACKAGE: NAME" GNU\ Sources 
catattr: file "GNU Sources", attribute "INSTALLER PACKAGE: NAME": No such file or directory
/b2/_packages_>

addattr

~/Desktop/catattr-test> ls
~/Desktop/catattr-test> touch this_is_a_file
~/Desktop/catattr-test> ln -sf this_is_a_file this_is_a_symlink
~/Desktop/catattr-test> ls -lh
total 4.0K
-rw-r--r-- 1 user root  0 Apr 25 11:28 this_is_a_file
lrwxrwxrwx 1 user root 14 Apr 25 11:28 this_is_a_symlink -> this_is_a_file
~/Desktop/catattr-test> addattr -t string "INSTALLER PACKAGE: NAME" "Source Code Tarballs" this_is_a_symlink 
~/Desktop/catattr-test> listattr this_is_a_symlink 
File: this_is_a_symlink
        Type       Size  Name                                
----------------------------------------------------------

0 bytes total in attributes.
~/Desktop/catattr-test> listattr this_is_a_file    
File: this_is_a_file
        Type       Size  Name                                
----------------------------------------------------------
        Text        21  "INSTALLER PACKAGE: NAME"

21 bytes total in attributes.
~/Desktop/catattr-test> 

Change History (2)

comment:1 by korli, 14 years ago

There is an option -P to avoid resolving links in addattr().

comment:2 by korli, 14 years ago

Resolution: fixed
Status: newclosed

Fixed for catattr in hrev36473.

Note: See TracTickets for help on using tickets.