omhacks FTBFS: open O_CREAT needs 3 arguments

Bug #521164 reported by Kamal Mostafa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
omhacks (Debian)
Fix Released
Unknown
omhacks (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

http://launchpadlibrarian.net/39017735/buildlog_ubuntu-lucid-i386.omhacks_0.8-1_FAILEDTOBUILD.txt.gz

cd /build/buildd/omhacks-0.8/obj-i486-linux-gnu/omhacks && /usr/bin/gcc -Domhacks_EXPORTS -g -O2 -fPIC -I/build/buildd/omhacks-0.8/omhacks/.. -Wall -Werror -o CMakeFiles/omhacks.dir/sysfs.c.o -c /build/buildd/omhacks-0.8/omhacks/sysfs.c
In file included from /usr/include/fcntl.h:205,
                 from /build/buildd/omhacks-0.8/omhacks/sysfs.c:28:
In function 'open',
    inlined from 'om_sysfs_writefile' at /build/buildd/omhacks-0.8/omhacks/sysfs.c:194:
/usr/include/bits/fcntl2.h:51: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[3]: *** [omhacks/CMakeFiles/omhacks.dir/sysfs.c.o] Error 1

Related branches

Changed in omhacks (Ubuntu):
assignee: nobody → Kamal Mostafa (kamalmostafa)
status: New → In Progress
Revision history for this message
Kamal Mostafa (kamalmostafa) wrote :

Attached branch fixes the FTBFS by adding the required standard 3rd argument to the open-with-O_CREAT call. Patch has been forwarded to Debian.

Changed in omhacks (Ubuntu):
assignee: Kamal Mostafa (kamalmostafa) → nobody
status: In Progress → Confirmed
Revision history for this message
StefanPotyra (sistpoty) wrote :

Hi,

patch looks good, but why do you set S_IWGRP|S_IWOTH? (looking at entries in /sys, these don't have group/others write permissions).

Cheers,
    Stefan.

Changed in omhacks (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Kamal Mostafa (kamalmostafa) wrote :

Hi Stefan-

The "mode" argument for open() with O_CREAT does not directly set the permissions of the file being created -- it just specifies the mode bits before modification by the process umask setting (see the open(2) man page). So enabling the read and write bits for all three 'classes' (user, group, and other) in the open() call allows the umask setting to control the permissions. The normal default umask (0022) will "strip away" the two permissions bits you questioned (group-write and other-write), so newly created files actually *will* get created with the permissions "-rw-r--r--" you're expecting... Unless, that is, the user has explicitly set their umask to something else, (say 0002, to allow other members of their group write-access to their files) in which case that same open() call will create a file with "-rw-rw-r--" which is just what the use wanted.

Specifying all six of the read/write user/group/other mode bits is the standard way to address source code which omits it.

Changed in omhacks (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package omhacks - 0.8-1ubuntu1

---------------
omhacks (0.8-1ubuntu1) lucid; urgency=low

  * Fix FTBFS: sysfs.c open with O_CREAT needs 3 arguments (LP: #521164)
 -- Kamal Mostafa <email address hidden> Fri, 12 Feb 2010 12:40:17 -0800

Changed in omhacks (Ubuntu):
status: Confirmed → Fix Released
Changed in omhacks (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.