Re: fcntl module

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 8/23/2009 8:37 PM: > For that matter, proposing an > O_SAFER to the glibc folks might be worthwhile. With kernel support for O_SAFER, our *_safer paradigms could even be more efficient (no fd_safer after the fact, so fewer k

Re: fcntl module

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/23/2009 6:01 PM: > Now that we have pipe2, accept4, the next step is to combine them with > the *-safer functionality. This overlaps with F_DUPFD and F_DUPFD_CLOEXEC. > So, the actual better primitives are > dup_ex (i

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Joel E. Denny
On Mon, 24 Aug 2009, Bruno Haible wrote: > > Thanks. I had never used "git rebase -i" before. At the squash step, it > > let me merge the git log entries but not the ChangeLog entries. Is there > > a way to do that? > > Yes: After the rebase is done, edit the ChangeLog, and record that chang

Re: proposal: module 'accept4'

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > Shouldn't we follow the lead of popen-safer, and cache whether pipe2 > exists, so that we aren't wasting time on a guaranteed ENOSYS on all > subsequent invocations? Good point. This should do it. Feel free to add the same optimization to lib/utimens.c. 2009-08-23 Bruno Haib

Re: fcntl module

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > So maybe at this point I will regroup a bit and figure out how to replace > broken fcntl on Unix-y systems, and focus on F_DUPFD_CLOEXEC first. Now that we have pipe2, accept4, the next step is to combine them with the *-safer functionality. This overlaps with F_DUPFD and F_DUP

Re: proposal: module 'accept4'

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/23/2009 4:58 PM: > Tolerate declared but missing pipe2 syscall. > * lib/pipe2.c (pipe2): Invoke original pipe2 function first, if > available. Shouldn't we follow the lead of popen-safer, and cache whet

Re: new module 'dup3'

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > In the case where oldfd was previously marked O_NOINHERIT, dup2() on mingw > appears to create newfd as O_NOINHERIT as well. I think we have to rework > this patch to use DuplicateHandle/_open_osfhandle on both control paths. No, this is not true in my experiments (done on Win

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Bruno Haible
Joel E. Denny wrote: > > 4. "git rebase -i HEAD~3" and in the editor change > > pick 3 > > pick 4 > > pick 5 > > into > > pick 3 > > squash 5 > > pick 4 > > (where the numbers 3, 4, 5 are more complicated than that). > > Thanks. I

Re: proposal: module 'accept4'

2009-08-23 Thread Bruno Haible
Paolo Bonzini wrote: > For binary GNU/Linux distributions, the package will usually > be built on the latest kernel, but the user may have chosen not to > install a new-enough kernel. I would see this as a bug in the Linux distro. They should use the oldest supported kernel, not the newest one,

Re: new module 'dup3'

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 8/23/2009 4:17 PM: > This implements the 'dup3' replacement function. > > Paolo's issue of use of older Linux kernels is not yet handled. Looks good. > #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ >

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Joel E. Denny
On Sun, 23 Aug 2009, Bruno Haible wrote: > > Ok to push the previous 4 patches followed by the one below? > > If you can do that, it would be preferable to merge the 3rd and 5th > patch together before pushing, because the intermediate states of your > work are hardly important for the future. O

Re: new module 'dup3'

2009-08-23 Thread Bruno Haible
Btw, the history of dup3 in the Linux kernel is here: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fstable%2Flinux-2.6.30.y.git&a=search&h=HEAD&st=commit&s=dup3

new module 'dup3'

2009-08-23 Thread Bruno Haible
This implements the 'dup3' replacement function. Paolo's issue of use of older Linux kernels is not yet handled. 2009-08-23 Bruno Haible New module 'dup3'. * lib/unistd.in.h (dup3): New declaration. * lib/dup3.c: New file. * m4/dup3.m4: New file. * m4/

tweak test-dup2

2009-08-23 Thread Bruno Haible
Eric, Let me know if you find these tweaks unreasonable. The first hunk is to ensure that even if a non-empty test-dup2.tmp existed before the test, it will not disturb the test. 2009-08-23 Bruno Haible Tweak the dup2 test. * tests/test-dup2.c (main): Create the test file emp

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Bruno Haible
Joel E. Denny wrote: > It occurs to me now that you might be thinking of multiple levels of > quotes. I had thought of escaping all kinds of parentheses and brackets: all of "[(])", but that does not make much sense. Multiple levels makes more sense, it's good to explain that. > Ok to push the p

Re: Tests failing to build with external getttext

2009-08-23 Thread Bruno Haible
Tom G. Christensen wrote on 2009-08-14: > Unfortunately another one just turned up: > gcc -std=gnu99 -g -O2 -L/usr/tgcware/lib -Wl,-R,/usr/tgcware/lib > -Wl,-z,ignore > -o test-getopt test-getopt.o ../gllib/libgnu.a -lm > Undefined first referenced > symbol

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Joel E. Denny
On Sun, 23 Aug 2009, Joel E. Denny wrote: > On Sun, 23 Aug 2009, Bruno Haible wrote: > > - Can you please avoid 1-letter identifiers as function parameters? > > 'l' and 'r', in particular. At the first glance, I thought it would > > be possible to set l = "[(" and r = "])". > > Why isn

fix getdtablesize() on mingw

2009-08-23 Thread Bruno Haible
On mingw, getdtablesize() currently returns 512 but the dup2 test shows that file descriptors up until 2047 can be used. (On Windows XP.) This fixes getdtablesize() so that it returns 2048. 2009-08-23 Bruno Haible Fix getdtablesize() on mingw. * lib/getdtablesize.c (getdtable

Re: proposal: module 'accept4'

2009-08-23 Thread Paolo Bonzini
On 08/23/2009 06:45 PM, Eric Blake wrote: Or are you saying that it is possible to compile on a newer glibc, then run with the same libc.so but against an older kernel, where the result of a configure-time test is no longer accurate? Exactly. For binary GNU/Linux distributions, the package wil

Re: proposal: module 'accept4'

2009-08-23 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Paolo Bonzini on 8/23/2009 10:22 AM: > This can be committed as is but it is not enough. You have to always > use a replacement (thus define the emulation as rpl_accept4) and check > whether accept4 works at runtime (and similarly for pip

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Joel E. Denny
On Sun, 23 Aug 2009, Bruno Haible wrote: > Hi Joel, Hi Bruno. > > +2009-08-22 Joel E. Denny > > + > > + quotearg-tests: test escaping of embedded locale quotes > > + * tests/test-quotearg.c (struct result_strings): Add member for > > + new input. > > + (LQ_ENC, RQ_ENC, RQ_ESC): New ma

Re: proposal: module 'accept4'

2009-08-23 Thread Paolo Bonzini
On 08/22/2009 11:39 PM, Bruno Haible wrote: Hi, Here's the proposed module for function 'accept4'. It does not define the macro SOCK_CLOEXEC. I think this macro should be replaced by a separate module, that would then also influence socket(), socketpair() - and what about connect()? Opinions?

Re: proposal: module 'mkostemp'

2009-08-23 Thread Bruno Haible
Jim Meyering wrote: > This looks fine. OK, applied... > FYI, since it modifies tempname.c and since coreutils has > a modified version of that gnulib file, I'll sync the interface > changes into coreutils' copy, eventually. ... with a change to NEWS, since the gen_tempname function signature cha

Re: proposal: module 'mkostemp'

2009-08-23 Thread Jim Meyering
Bruno Haible wrote: > Here is a proposal to add a module 'mkostemp', using the source code changes > from glibc. It also reduces the diffs to glibc, by incorporating parts of this > glibc commit: > > http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d7e23b02a40384be1eaf00762ea36fd117c462cd >

Re: quotearg: implement custom_quoting_style

2009-08-23 Thread Bruno Haible
Hi Joel, > +2009-08-22 Joel E. Denny > + > + quotearg-tests: test escaping of embedded locale quotes > + * tests/test-quotearg.c (struct result_strings): Add member for > + new input. > + (LQ_ENC, RQ_ENC, RQ_ESC): New macros. > + (inputs): Add new input. > + (results_g):

Re: proposal: module 'mkostemp'

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > Nice to do some resyncing. Overall, I'm in favor of this improvement. I also wait for Jim's opinion. > > /* Generate a unique temporary file name from TEMPLATE. > >The last six characters of TEMPLATE must be "XX"; > >they are replaced with a string that makes the

Re: proposal: module 'accept4'

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > > nfd = _open_osfhandle ((long) new_handle, > > O_NOINHERIT | (flags & (O_TEXT | O_BINARY))); > > if (nfd < 0) > > { > > int saved_errno = errno; > > close (fd); > > errno = saved_errno; > > return -1; > > } >

Re: fcntl module

2009-08-23 Thread Paolo Bonzini
On 08/22/2009 06:36 PM, Bruno Haible wrote: Paolo Bonzini wrote: Also, actually the flags can be accessed; it's undocumented but it can be found. See for example these files, taken from Perl and Ruby respectively: http://downloads.activestate.com/contrib.old/ntsock.cpp http://www.google.com/co

Re: new module 'pipe2'

2009-08-23 Thread Bruno Haible
Eric Blake wrote: > Also, should we offer O_BINARY/O_TEXT support on > cygwin, using setmode()? (On Linux, O_BINARY and O_TEXT are both 0, so we > have implicitly already done so). After 1 sec of thinking, yes. There is no reason to offer O_BINARY, O_TEXT in accept4 but not in pipe2. Committed: