HP3000-L Archives

April 2006, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Edward Berner <[log in to unmask]>
Reply To:
Edward Berner <[log in to unmask]>
Date:
Wed, 19 Apr 2006 17:19:43 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (84 lines)
On Mon, 20 Mar 2006 13:54:19 -0500, Edward Berner 
<[log in to unmask]> wrote:

>Is it possible to change the owner of a symbolic link without actually 
>recreating the link?  ALTFILE foo;OWNER=bar "sees through" the link and 
>changes the owner of the target file instead of the link itself.
>

Just to followup,

I didn't find a way to change the owner of a symbolic link without 
recreating or otherwise replacing the link.

The best method I found was to STORE the link and then RESTORE it with the 
CREATOR= option.

Here is a script I wrote to automate that process.  (If you use it you'll 
have to customize the location of the store file specified in the 
LCHOWN_STORE_FILE variable.)

----- begin script -----
PARM OWNER, FILENAME

#
# Edward Berner
# Yosemite Community College District
# 4/19/2006
#

#
# Change the owner of a symbolic link file.  One would expect
# ALTFILE to work but it doesn't -- it "sees through" the link
# and changes the owner of the link target instead.
#
# The best way I've found so far to change the owner of a link is
# to STORE the file and the RESTORE it with the CREATOR= option.
#

SETJCW INSIDEMPEX 0
IF INSIDEMPEX = 1 THEN
    MPE XEQ CI.PUB.SYS;INFO="!HPFILE !OWNER, !FILENAME";PARM=3
    RETURN
ENDIF

SETVAR LCHOWN_STORE_FILE "LCHOWNST.TEMP.TEMP"
IF FINFO (LCHOWN_STORE_FILE, "EXISTS") THEN
    PURGE !LCHOWN_STORE_FILE
ENDIF

SETVAR LCHOWN_OWNER "!OWNER"
SETVAR LCHOWN_FILENAME "!FILENAME"
SETVAR LCHOWN_VERBOSE TRUE

SETVAR LCHOWN_ORIGOWNER FINFO (LCHOWN_FILENAME, "OWNER")

IF FINFO (LCHOWN_FILENAME, "FILETYPE") = "SYMLINK" THEN
    FILE LCHOWNST=!LCHOWN_STORE_FILE ;DEV=DISC
    STORE !LCHOWN_FILENAME ;*LCHOWNST > $NULL
    RESTORE *LCHOWNST ;!LCHOWN_FILENAME ;OLDDATE;CREATOR=!LCHOWN_OWNER > 
$NULL
    RESET LCHOWNST
    SETVAR LCHOWN_NEWOWNER FINFO (LCHOWN_FILENAME, "OWNER")
    IF LCHOWN_VERBOSE THEN
        ECHO Filename:       !LCHOWN_FILENAME
        ECHO Original owner: !LCHOWN_ORIGOWNER
        ECHO New owner:      !LCHOWN_NEWOWNER
    ENDIF
ELSE
    ECHO !LCHOWN_FILENAME is not a symbolic link.
ENDIF

IF FINFO (LCHOWN_STORE_FILE, "EXISTS") THEN
    PURGE !LCHOWN_STORE_FILE
ENDIF

DELETEVAR LCHOWN_@
----- end script -----

later,
Edward

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2