#18355 closed bug (fixed)

open() fails when the argument is a symbolic link to a nonexistent file

Reported by: bhaible Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: System/POSIX Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

POSIX https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html specifies that "In general, the open() function follows the symbolic link if path names a symbolic link." and lists a few conditions under which open(), when passed an argument that is a symbolic link, must fail. These conditions are not met when the argument is simply a symbolic link to a nonexistent file in an existing directory (such as the current directory). Therefore, in this case, the open() call should succeeds, and a regular file should be created at the place the symbolic link points to.

But in Haiku r1beta4, the open() calls fails with errno ENOENT.

How to reproduce:

$ gcc -Wall foo.c
$ ./a.out

Expected output:

symlink -> 0
ret -> 3

Actual output:

symlink -> 0
open: No such file or directory

Attachments (1)

foo.c (439 bytes ) - added by bhaible 20 months ago.
test case

Download all attachments as: .zip

Change History (3)

by bhaible, 20 months ago

Attachment: foo.c added

test case

comment:2 by waddlesplash, 11 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev57507.

Note: See TracTickets for help on using tickets.