Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gzip not preserving file ownership 1

Status
Not open for further replies.

philipose

Programmer
Dec 24, 2003
137
0
0
US
Gurus,
I am having a problem with preserving file ownership during gzip. The operating system is AIX 5.2 and the output of gzip -V is

gzip 1.2.4 (18 Aug 93)
Compilation options:
DIRENT UTIME STDC_HEADERS HAVE_UNISTD_H

The ownership of the file is not preserved after a gzip, but modification time and permissions are preserved. My understanding is that gzip preserves file ownerships too. If you have any thoughts or suggestions, please let me know. I do not have root permissions or superuser permissions.
Regards
Zacharia
 
You say not preserving ownership. So, for example, take a file:

rwxr-xr-x 3 oracle dba 512 May 6 04:40 control.idx

When you gzip it is no longer saving the oracle:dba perms? What are the owner perms? And is this when you decompress a gzip file?
 
gzip will only preserve ownership when run as root afaik.


HTH,

p5wizard
 
I disagree.

It preserves ownership even if you run with non-root user.

Phillipos,
What is the current ML level in your system. Check with
$instfix -i|grep ML
post the output of the above commmand.

I guess, in your case, you may have to apply ML or all files not installed for the current ML level. Check that out.


aixnag
IBM Certified Specialist - P-series AIX 5L Administration
IBM Certified Specialist - AIX V4 HACMP
IBM eServer Certified Specialist – p690 Technical Support
IBM Certified Solutions Expert - DB2 UDB V7.1 Database Administration for Unix, Linux, Windows and OS/2
 
aixnag,
thanks for your time. below is the output of the command instfix -i|grep ML
All filesets for 5.2.0.0_AIX_ML were found.
All filesets for 5200-01_AIX_ML were found.
All filesets for 5200-02_AIX_ML were found.
All filesets for 5200-03_AIX_ML were found.
All filesets for 5200-04_AIX_ML were found.
All filesets for 5200-05_AIX_ML were found.
All filesets for 5200-06_AIX_ML were found.
philipose
 
In my environment,we applied ML04 with critical patches. gzip works fine.
In your case, need to figure out which critical fix is required, can you post the following outputs.
#lslpp -h rpm.rte
#ls -l `which gzip`
#ls -l /usr/opt/freeware/bin/gzip



aixnag
IBM Certified Specialist - P-series AIX 5L Administration
IBM Certified Specialist - AIX V4 HACMP
IBM eServer Certified Specialist – p690 Technical Support
IBM Certified Solutions Expert - DB2 UDB V7.1 Database Administration for Unix, Linux, Windows and OS/2
 
aixnag,

Here you go!

lslpp -h rpm.rte

Fileset Level Action Status Date Time
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
rpm.rte
3.0.5.36 COMMIT COMPLETE 12/03/04 09:49:59

Path: /etc/objrepos
rpm.rte
3.0.5.36 COMMIT COMPLETE 12/03/04 09:50:39

ls -l `which gzip`
lrwxrwxrwx 1 root system 26 May 21 18:00 /usr/bin/gzip@ -> /usr/opt/freeware/bin/gzip*

ls -l /usr/opt/freeware/bin/gzip
-rwxr-xr-x 3 root system 66303 Sep 08 2003 /usr/opt/freeware/bin/gzip*

philipose

 
What about collecting the ownership/permission info into a script and include that in the zip?

Not perfect but works (I'm sure someone can improve on this)

Code:
ls -ld * | awk '{print "chown "$3":"$4,$9}' > file1

(see below for perms.ksh code)

perms.ksh *  > file2

ls -ld * | awk '{print $9}' > file3

paste file2 file3 > file4

sed -e 's/[put a tab in here]/ /' < file4 > file5

cat file1 file5 > sav.perms

Code:
#!/bin/ksh
ls -ld $* | 'BEGIN {
v["r1"]=400; v["w2"]=200; v["x3"]=100; v["s3"]=4100; v["S3"]=4000
v["r4"]=40 ; v["w5"]=20 ; v["x6"]=10 ; v["s6"]=2010; v["S6"]=2000
v["r7"]=4  ; v["w8"]=2  ; v["x9"]=1  ; v["t9"]=1001; v["T3"]=1000}
{val=0
for (i=1;i<=9;i++) val=val+v[substr($0,i+1,1)i]
printd "chmod""%4 %s\n",val,$NF}'

Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top