Operating System - HP-UX
1748142 Members
3580 Online
108758 Solutions
New Discussion юеВ

Re: How to create symbolic link permission of lr--r--r-T

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Re: How to create symbolic link permission of lr--r--r-T

Mark, I'm not ignoring any responses. Just want to know how to create the link. I appreciate all responses. Hope nothing taken the wron way.

jack...
Mark Grant
Honored Contributor

Re: How to create symbolic link permission of lr--r--r-T

Jack,

Sorry, didn't mean to imply anybody was really being ignored, it's just my perculiar type of English I guess :)

Still, I really would be surprised if these permissions can be achieved on the link without a little bit of C and some inode mangling magic.

Never preceed any demonstration with anything more predictive than "watch this"
Steven Gillard_2
Honored Contributor
Solution

Re: How to create symbolic link permission of lr--r--r-T

Looks like it could be something to do with signifying the link as a "transition link":

# rm /etc/termcap
# tlinstall
NOTE: tlinstall is searching filesystem - please be patient
NOTE: Successfully completed
# ll /etc/termcap
lr--r--r-T 1 root sys 22 Sep 11 15:46 /etc/termcap -> /usr/share/lib/termcap

See man tlinstall for more info.

A "tusc" of the tlinstall command reveals it uses the lchmod() system call to set the mode:

lchmod("/etc/termcap", 0101444) ............................... = 0

This system call is undocumented (ie no man page), but its easy to write a C program that can use it.

Regards,
Steve
Helen French
Honored Contributor

Re: How to create symbolic link permission of lr--r--r-T

From 'man umask': " Note that the file creation mode mask does not affect the set-user-id, set-group-id, or "sticky" bits."

The permission "T" (sticky bit set without "execute" permission for "others") can be set only with chmod command. Since you cannot set it on symbolic links, the best way is to tar and untar the file.
Life is a promise, fulfill it!
hein coulier
Frequent Advisor

Re: How to create symbolic link permission of lr--r--r-T

perhaps you can copy the link from one system to the other with tar ?
Stefan Farrelly
Honored Contributor

Re: How to create symbolic link permission of lr--r--r-T

Jack,

I dont believe you can do it. Certainly not easily anyway. Umask wont allow it, chmod wont allow it (binary or C call). Ive tried all sorts of C calls to create, modify, open, write files and none will do it. C ignores the symlink also - goes straight to its destination.

I think youre going to have to bite the bullet and do it the hard way and tar it over from another server.

Now, if I had assembler for HP-UX and I could recall how to do it I think it would be possible!

It would certainly be interesting though to find out how HP created it in the first place.
/etc/termcap is not listed under swlist -l file which means its not on the source, but its created at some point by some program. Any ideas anyone which program it is ? I think it must exist on a server.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Patrick Wallek
Honored Contributor

Re: How to create symbolic link permission of lr--r--r-T

OK, I think I know what you can do.

The /etc/termcap link to /usr/share/lib/termcap is a 9.X to 10.X transition link.

If you execute the command:

# /opt/upgrade/bin/tllist

It will show a list of all transition links that have been installed on your system. You will notice that /etc/termcap is one of those.

If you really want to re-establish the link the way it should be you can probably use the tlinstall command.

To preview what tlinstall will do:

# /opt/upgrade/bin/tlinstall -p -v

To actually have tlinstall recreate the transition link (I believe it will only recreate what is not there):

# /opt/upgrade/bin/tlinstall -v -l

Note: As far as I know this is the ONLY way to (re)create /etc/termcap with the permissions that it should have. It can not be done with the regular chmod command. /etc/termcap is a special case.
Jack C. Mahaffey
Super Advisor

Re: How to create symbolic link permission of lr--r--r-T

Forgot about the &##! transision links.

Thanks to all for your help. Ran tlinstall and the link got recreated.


Nothing like a challenge to keep the minds going. :)

Jack...
A. Clay Stephenson
Acclaimed Contributor

Re: How to create symbolic link permission of lr--r--r-T

Well, boys and girls. It can be done and I'll learn you how HP does it. As has been noted, the system call chmod() follows the symbolic link and thus does not operate on the symbolic link directly. Similarly, the symlink() system call does not allow a mode argument so that don't work neither. However, there is an UNDOCUMENTED system call, lchmod(), that does operate directly on the symbolic link.

The attached code illutrates its use. I intentionally did this in K&R C so that even the bundled C compiler can handle it. Compile like this:

cc lchmod.c -o lchmod

Use it like this on an EXISTING symbolic link.

lchmod 1664 mysymlink1

NOTE: This guy only understands OCTAL permissions but you are free to make it smarter if you like.

Regards,
Clay
If it ain't broke, I can fix that.
Greg White
Frequent Advisor

Re: How to create symbolic link permission of lr--r--r-T

Hi,

I have been following this thread all day because it was so interesting and challenging. After reading Stefan's comments and repeating some of his attempts in C, I too was completely baffled. Then I saw our Clay's last answer and was amazed. I tried it and it worked! So Clay, how did you know about this secret and undocumented lchmod function? You must be using some inside HP connections to come up with that answer.

PS Jack, you need to give Clay 50 points for that answer because he really solved a mystery.

I love this place,
Greg


I know how to do it in pascal.