[cups.bugs] [HIGH] STR #3196: non-portable issues and OpenBSD fix

Kurt Miller kurt at intricatesoftware.com
Fri May 15 09:44:24 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

More details regarding portability issues in the submitted patches:

patch-scheduler_main_c:
Threaded cups is relying on non-portable behavior according to POSIX.
Specifically a threaded application that forks may only call
async-signal-safe functions in the child process. See the following:

http://www.opengroup.org/onlinepubs/009695399/functions/fork.html

The twentieth bullet point states:

"the child process may only execute async-signal-safe operations until
such time as one of the exec functions is called"

The list of async-signal-safe functions is at the end of the following
page:

http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html

Cups is not limiting itself to that list after the fork() call.

To be fully portable to all OS's, the Apple specific code for 'Run as
child with config file' should be used in all cases, not just Apple and
OpenBSD.

patch-scheduler_process_c:

There's nothing in POSIX that states dup() or open() will return the
lowest available file descriptor. close(0); open(); is not a portable way
to ensure the file descriptor returned by open() ends up at 0. dup2(fd, 0)
is needed to be portable.

Link: http://www.cups.org/str.php?L3196
Version: 1.3.10





More information about the cups mailing list