bug-hurd
[Top][All Lists]
Advanced

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

What is ``access (NULL, whatever)'' supposed to do?


From: Thomas Schwinge
Subject: What is ``access (NULL, whatever)'' supposed to do?
Date: Mon, 9 Apr 2007 20:43:25 +0200
User-agent: Mutt/1.5.11

Hello!

While bringing the git rcs's binary package in an up-to-date state for
us, I saw the following: I saw it segfault.

#v+
Starting program: /devel3/tschwinge/tmp/git/git-core-1.5.1/git add .

Program received signal SIGSEGV, Segmentation fault.
0x0105fc56 in __hurd_file_name_lookup (use_init_port=0x101aba8, 
get_dtable_port=0x40000002, lookup=0, 
    file_name=0x40000002 <Address 0x40000002 out of bounds>, flags=0, 
mode=1073741826, result=0x40000002) at hurdlookup.c:67
67      hurdlookup.c: No such file or directory.
        in hurdlookup.c
(gdb) bt
#0  0x0105fc56 in __hurd_file_name_lookup (use_init_port=0x101aba8, 
get_dtable_port=0x40000002, lookup=0, 
    file_name=0x40000002 <Address 0x40000002 out of bounds>, flags=0, 
mode=1073741826, result=0x40000002) at hurdlookup.c:67
#1  0x0112e517 in __access (file=0x40000002 <Address 0x40000002 out of bounds>, 
type=4) at ../sysdeps/mach/hurd/access.c:112
#2  0x0804b568 in cmd_add (argc=2, argv=0x101adf8, prefix=0x0) at 
builtin-add.c:72
#3  0x0804a804 in handle_internal_command (argc=2, argv=0x101adf8, envp=<value 
optimized out>) at git.c:322
#4  0x0804ac5f in main (argc=Cannot access memory at address 0x0
) at git.c:391
(gdb) frame 2
#2  0x0804b568 in cmd_add (argc=2, argv=0x101adf8, prefix=0x0) at 
builtin-add.c:72
72              if (!access(excludes_file, R_OK))
(gdb) print excludes_file 
$1 = 0x0
#v-

In glibc's `io/access.c' there is the following code:

#v+
int
__access (file, type)
     const char *file;
     int type;
{
  if (file == NULL || (type & ~(R_OK|W_OK|X_OK|F_OK)) != 0)
    {
      __set_errno (EINVAL);
      return -1;
    }
[...]
#v-

(And the Linux code does the same thing, I guess.)

However the Hurd's `sysdeps/mach/hurd/access.c' does not catch ``file ==
NULL''.  Should it do so?  Reading
<http://opengroup.org/onlinepubs/000095399/functions/access.html>
doesn't tell me whether it should or not.


I think we already had the very same problem in the past with some qt
package, a qt Makefile generator or whatever, but I can't locate that
issue's email correspondence at the moment.  I think they fixed it
locally in their code to not call `access' with a NULL path.


Regards,
 Thomas

Attachment: signature.asc
Description: Digital signature


reply via email to

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