RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1748685 - compress/uncompress file shows "chown error (ignored) file: Operation not permitted"
Summary: compress/uncompress file shows "chown error (ignored) file: Operation not pe...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ncompress
Version: 7.6
Hardware: Unspecified
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Petr Kubat
QA Contact: RHEL CS Apps Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 1823668 1830869
TreeView+ depends on / blocked
 
Reported: 2019-09-04 01:58 UTC by yangfei
Modified: 2023-10-06 18:31 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1823668 1830869 (view as bug list)
Environment:
Last Closed: 2020-10-21 09:36:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description yangfei 2019-09-04 01:58:23 UTC
Description of problem:


compress/uncompress report error on nfs share directory.

Version-Release number of selected component (if applicable):

$ diff -u ncompress-4.2.4/compress42.c ncompress-4.2.4.4/compress42.c
--- ncompress-4.2.4/compress42.c        2019-08-30 10:08:13.114575607 +0100            <=== RHEL6
+++ ncompress-4.2.4.4/compress42.c      2019-08-30 10:08:25.478744353 +0100            <=== RHEL7
...
@@ -1222,7 +1252,12 @@
                                                exit_code = 1;
                                        }
 #ifndef        DOS
-                                       chown(ofname, infstat.st_uid, infstat.st_gid);  /* Copy ownership */
+                                       if (chown(ofname, infstat.st_uid, infstat.st_gid))      /* Copy ownership */
+                                       {
+                                               fprintf(stderr, "\nchown error (ignored) ");
+                                               perror(ofname);
+                                               exit_code = 1;
+                                       }
 #endif
 #endif


How reproducible:

rhel7/ kernel-3.10.0-862.el7.x86_64

x.x.x.x:/test /test1 nfs4 rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.72.37.x,local_lock=none,addr=10.72.37.x 0 0

# compress t2 

chown error (ignored) t2.Z: Operation not permitted
[root@mytest test1]# ll
total 5980084
-rw-r--r-- 1 nobody nobody 6123565056 May 17  2018 file
-rw-r--r-- 1 nobody nobody      34563 Aug 29 17:00 t2.Z
-rw-r--r-- 1 nobody nobody          0 Jul  9 13:01 testing


rhel6/kernel-2.6.32-754.12.1.el6.x86_64

x.x.x.x:/test/ /test nfs4 rw,relatime,vers=4,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.72.37.x,minorversion=0,local_lock=none,addr=10.72.37.x 0 0

# compress t2 
[root@myldap test]# ll
total 5980084
-rw-r--r-- 1 nobody nobody 6123565056 May 17  2018 file
-rw-r--r-- 1 nobody nobody      34563 Aug 29 17:00 t2.Z
-rw-r--r-- 1 nobody nobody          0 Jul  9 13:01 testing

From strace result,we can see rhel6 report "exited with 0"but rhel7 "exited with 1",  ?

rhel6:

utime("t2.Z", [2019/08/30-10:37:34, 2019/08/29-17:00:07]) = 0
chmod("t2.Z", 0644)                     = 0
chown("t2.Z", 99, 99)                   = -1 EPERM (Operation not permitted)
unlink("t2")                            = 0
exit_group(0)                           = ?
+++ exited with 0 +++


# rhel7 as following

utime("t2.Z", [2019/08/30-10:37:34, 2019/08/29-17:00:07]) = 0
chmod("t2.Z", 0644)                     = 0
chown("t2.Z", 99, 99)                   = -1 EPERM (Operation not permitted)
write(2, "\nchown error (ignored) ", 23
chown error (ignored) ) = 23
write(2, "t2.Z: Operation not permitted\n", 30t2.Z: Operation not permitted
) = 30
unlink("t2")                            = 0
exit_group(1)                           = ?
+++ exited with 1 +++


Expected results:

Why rhel6 report "exited with 0"but rhel7 "exited with 1",  ?

Comment 2 Petr Kubat 2019-09-04 05:42:03 UTC
Hi yangfei,

thanks for the report, though I am not sure I understand it correctly. It seems like you are asking why there a warning that the return value of chown got ignored in RHEL7, but there is none on RHEL6?
The reason for this is that RHEL6 has slightly older ncompress version (4.2.4), while RHEL7 carries a slightly newer one (4.2.4.4). As far as I can see the chown check got added in 4.2.4.3 [1] so it makes sense it is not present in rhel6.

[1] https://github.com/vapier/ncompress/commit/c3f07e983f80be6d48c5c4380247cb34a4bfa1f2

Comment 3 yangfei 2019-09-04 05:52:31 UTC
Hello Petr,

Thanks for your replying!

the point cu focused is about the return code, because their application will check the return code, so cu confused why rhel6 and rhel7 are different. 

Is this a bug in rhel6 and rhel7 fixes it ?

Comment 4 Petr Kubat 2019-09-04 06:08:27 UTC
Ah yes, thanks for restating!

It does look like a bugfix that happened in 4.2.4.3, though I do not have any details about it as it is pretty old.
Looking at the code, the other branches that ignore return values of calls to chmod, utime and unlink also set the exit code to 1 so I would say it is expected to happen with the call to chown as well:

https://github.com/vapier/ncompress/blob/ncompress-4.2.4/compress42.c#L1188

I can raise a question to upstream to provide more details about the exit code value if you want me to.

Comment 5 yangfei 2019-09-04 06:22:54 UTC
cool, much appreciated for raising the question to upstream, customer would like to know the result  : )

Comment 6 Petr Kubat 2019-09-04 10:43:41 UTC
Question raised overe here: https://github.com/vapier/ncompress/issues/22

Comment 7 Petr Kubat 2019-10-23 07:30:04 UTC
Fixed upstream via: https://github.com/vapier/ncompress/pull/25


Note You need to log in before you can comment on or make changes to this bug.