Opened 14 years ago

Closed 14 years ago

#29279 closed defect (fixed)

policykit build fails -- polkitagenthelperprivate.c uses fdatasync()

Reported by: gnw3 Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: fdatasync Cc: blair (Blair Zajac), rmstonecipher@…, ryandesign (Ryan Carsten Schmidt), pheonix@…, chris@…, ebbinghaus@…, ballapete (Peter "Pete" Dyballa), dershow, McDutchie (Martijn Dekker), kgalinsky@…
Port: policykit

Description

In polkitagenthelperprivate.c there are two calls to fdatasync(). This results in a build failure (unsatfisfied external).

According the linux man page

On  POSIX  systems  on  which fdatasync() is available,
_POSIX_SYNCHRONIZED_IO is defined in <unistd.h> to a 
value greater than 0.

Here, Leopard and Snow Leopard /usr/include/unistd.h as well as the Developer/SDK versions all have:

#define _POSIX_SYNCHRONIZED_IO (-1)

As a workaround, I just edited the file to replace fdatasync with fdata and the build succeeded. A Google search suggests that some OS X systems do have fdatasync, but that the headers don't provide a prototype.

Attachments (2)

Portfile-policykit.diff (521 bytes) - added by kgalinsky@… 14 years ago.
Call reinplace on polkitagenthelperprivate
policykit-portfile-patch.tar.gz (563 bytes) - added by kgalinsky@… 14 years ago.
Fix as per blair's suggestion in case reinplace isn't suitable - includes patch for src/polkitagent/polkitagenthelperprivate.c and for the Portfile where the patch will only get applied for older OSes by using patchfiles-append in the pre-patch phase.

Download all attachments as: .zip

Change History (21)

comment:1 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added
Keywords: policykit removed
Owner: changed from macports-tickets@… to devans@…

The build succeeded for me on Snow Leopard, but not Leopard or Tiger, so that's what I wrote in the bug report I submitted to the developers.

comment:2 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: pheonix@… added

Has duplicate #29282.

comment:3 Changed 14 years ago by chris@…

Cc: chris@… added

Cc Me!

comment:4 Changed 14 years ago by chris@…

I think gnwiii may have meant he replaced fdatasync with fsync, not fdata. When I replaced with fdata I got an error, but with fsync it worked. Also, this page says fdatasync and fsync should be the same:

http://pubs.opengroup.org/onlinepubs/009695399/functions/fdatasync.html

comment:5 Changed 14 years ago by ebbinghaus@…

Cc: ebbinghaus@… added

Cc Me!

comment:6 Changed 14 years ago by jmroot (Joshua Root)

Cc: rmstonecipher@… added

comment:7 Changed 14 years ago by fiee (Henning Hraban Ramm)

ACK: When I replace "fdatasync" with "fsync" in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_security_policykit/work/polkit-0.101/src/polkitagent/polkitagenthelperprivate.c it works for me on OSX 10.5.8 Intel.

comment:8 in reply to:  4 Changed 14 years ago by gnw3

Replying to chris@…:

I think gnwiii may have meant he replaced fdatasync with fsync, not fdata. When I replaced with fdata I got an error, but with fsync it worked. Also, this page says fdatasync and fsync should be the same:

http://pubs.opengroup.org/onlinepubs/009695399/functions/fdatasync.html

You are right -- I meant to type "fsync", not "fdata". The two functions may not be the same, as fdatasync only claims "synchronized I/O data integrity completion", so fsync may be slower (I would think policykit should err on the side of portability over performance):

3.375 Synchronized I/O Data Integrity Completion

For read, [...].

For write, when the operation has been completed or diagnosed if unsuccessful. The write is complete only when the data specified in the write request is successfully transferred and all file system information required to retrieve the data is successfully transferred.

File attributes that are not necessary for data retrieval (access time, modification time, status change time) need not be successfully transferred prior to returning to the calling process.

3.376 Synchronized I/O File Integrity Completion

Identical to a synchronized I/O data integrity completion with the addition that all file attributes relative to the I/O operation (including access time, modification time, status change time) are successfully transferred prior to returning to the calling process.

http://pubs.opengroup.org/onlinepubs/009604599/basedefs/xbd_chap03.html

comment:9 Changed 14 years ago by ballapete (Peter "Pete" Dyballa)

Cc: Peter_Dyballa@… added

Cc Me!

comment:10 in reply to:  7 Changed 14 years ago by ballapete (Peter "Pete" Dyballa)

Replying to hraban@…:

ACK: When I replace "fdatasync" with "fsync" in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_security_policykit/work/polkit-0.101/src/polkitagent/polkitagenthelperprivate.c it works for me on OSX 10.5.8 Intel.

Same here with 10.5.8 PPC.

comment:11 Changed 14 years ago by blair (Blair Zajac)

If someone wants to create a patch that applies the changes to polkitagenthelperprivate.c and modifies Portfile to apply the patch only on OSes older than Snow Leopard, I can commit it to MacPorts.

comment:12 Changed 14 years ago by dershow

Cc: dersh@… added

Cc Me!

Changed 14 years ago by kgalinsky@…

Attachment: Portfile-policykit.diff added

Call reinplace on polkitagenthelperprivate

comment:13 Changed 14 years ago by kgalinsky@…

Attached a diff for a portfile that fixes the issue. It uses reinplace rather than applying a patch for older OSes (reinplace was already being run on other files for OSes older than Snow Leopard).

comment:14 Changed 14 years ago by McDutchie (Martijn Dekker)

Cc: martijn@… added

Cc Me!

Changed 14 years ago by kgalinsky@…

Fix as per blair's suggestion in case reinplace isn't suitable - includes patch for src/polkitagent/polkitagenthelperprivate.c and for the Portfile where the patch will only get applied for older OSes by using patchfiles-append in the pre-patch phase.

comment:15 Changed 14 years ago by kgalinsky@…

Cc: kgalinsky@… added

Cc Me!

comment:16 Changed 14 years ago by giby_the_kid@…

I tried to change fdatasync by fsync in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_security_policykit/work/polkit-0.101/src/polkitagent/polkitagenthelperprivate.c it hasn't work...

comment:17 in reply to:  16 Changed 14 years ago by gnw3

Replying to giby_the_kid@…:

I tried to change fdatasync by fsync in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_security_policykit/work/polkit-0.101/src/polkitagent/polkitagenthelperprivate.c it hasn't work...

Not much to go here, but now that there are a couple proposed patches, why not create a local portfile repository and test one of the proposed fixes?

comment:18 Changed 14 years ago by jmroot (Joshua Root)

Cc: blair@… added

comment:19 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

Thanks; r78414.

Note: See TracTickets for help on using tickets.