bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#10305: coreutils-8.21, some changes needed


From: Pádraig Brady
Subject: Re: bug#10305: coreutils-8.21, some changes needed
Date: Tue, 19 Feb 2013 10:28:37 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 02/19/2013 09:08 AM, Joachim Schmitz wrote:
-----Original Message-----
From: Joachim Schmitz [mailto:address@hidden
Sent: Tuesday, February 19, 2013 9:18 AM
To: 'address@hidden'; 'address@hidden'
Subject: coreutils-8.21, some changes needed

Hi folks

In an attempt to port coreutils 8.21 to HP-NonStop I stumbled accross a couple 
problems, here are my fixes to them:

Here another file needs to get adjusted to using the new root-uid.h

diff -EBbu ./src/copy.c.orig ./src/copy.c
--- ./src/copy.c.orig   2013-02-07 03:37:05 -0600
+++ ./src/copy.c        2013-02-18 09:29:22 -0600
@@ -51,6 +51,7 @@
  #include "ignore-value.h"
  #include "ioblksize.h"
  #include "quote.h"
+#include "root-uid.h"
  #include "same.h"
  #include "savedir.h"
  #include "stat-size.h"
@@ -1127,7 +1128,7 @@
      {
        bool access_changed = false;

-      if (!(sb.st_mode & S_IWUSR) && geteuid () != 0)
+      if (!(sb.st_mode & S_IWUSR) && geteuid () != ROOT_UID)
          access_changed = fchmod_or_lchmod (dest_desc, dst_name, 0600) == 0;

        if (!copy_attr (src_name, source_desc, dst_name, dest_desc, x)
@@ -2718,7 +2719,7 @@
      priv_freeset (pset);
    }
  #else
-  x->chown_privileges = x->owner_privileges = (geteuid () == 0);
+  x->chown_privileges = x->owner_privileges = (geteuid () == ROOT_UID);
  #endif
  }

I'll apply this in your name.

On HP-NonStop we use  0x80000000 instead of -1 for getuid(), getgid() and 
friends to indicate NO_UID rsp. NO_GID
Guess that difference could go into gnulibs root-uid.h?

You could wrap get[gu]id() to return -1 in that case,
or alternatively define NO_UID and NO_GID in root-uid.h
and use that everywhere. Probably the easiest approach
for coreutils at least since it already users NO_GID since:
http://bugs.gnu.org/10021
Though I note that root-uid.h would be an inaccurate
name if we did that.

BTW, Is 0 a valid "non root" user id on nonstop?
If not then we could use the wrapper approach to
hide the ROOT_UID issue also.

In the meantime we should at least document these differences
in gnulib in doc/posix-functions/getuid.texi.

Such a change would affect coreutils in 
...src/{groups,id,install,test,whoami}.c (in addition to root-uid.h of course)


Here two trailing _ seem missing?

diff -EBbu ./src/numfmt.c.orig ./src/numfmt.c
--- ./src/numfmt.c.orig 2013-02-14 08:49:30 -0600
+++ ./src/numfmt.c      2013-02-18 10:58:27 -0600
@@ -1195,7 +1195,7 @@
     Returns a pointer to the *delimiter* of the requested field,
     or a pointer to NUL (if reached the end of the string).  */
  static inline char *
-__attribute ((pure))
+__attribute__ ((pure))

Oops. I'll fix this up with a more extensive patch in coreutils.

Thanks,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]