bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-patch] FW: patch-2.7: "make check" problem on HP NonStop: we ca


From: Andreas Grünbacher
Subject: Re: [bug-patch] FW: patch-2.7: "make check" problem on HP NonStop: we can't open() a symlink
Date: Thu, 13 Sep 2012 14:30:08 +0200

Joachim,

2012/9/13 Joachim Schmitz <address@hidden>:
> FYI, not sure whether it made it to the list,

it seems not. Thanks for the bug report.

> -----Original Message-----
> From: Joachim Schmitz [mailto:address@hidden
> Sent: Thursday, September 13, 2012 12:02 PM
> To: 'address@hidden'
> Subject: patch-7.2: "make check" problem on HP NonStop: we can't open() a 
> symlink
>
> .patch-2.7/tests $ make check
> make  check-TESTS
> .
> PASS: crlf-handling
> XFAIL: dash-o-append
> PASS: empty-files
> .
> PASS: remember-reject-files
> FAIL: symlinks
> PASS: unmodified-files
> ============================================================================
> Testsuite summary for GNU patch 2.7
> ============================================================================
> # TOTAL: 34
> # PASS:  32
> # SKIP:  0
> # XFAIL: 1
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
> ============================================================================
> See tests/test-suite.log
> Please report to address@hidden
> ./patch-2.7/tests $ cat test-suite.log
> =========================================
>    GNU patch 2.7: tests/test-suite.log
> =========================================
>
> # TOTAL: 34
> # PASS:  32
> # SKIP:  0
> # XFAIL: 1
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
>
> .. contents:: :depth: 2
>
> XFAIL: dash-o-append
> ====================
>
> * patch -o a.new a < a.diff
> FAILED
> expected:
> patching file a
> patching file a
> got:
> patching file a.new (read from a)
> patching file a.new (read from a)
> Hunk #1 FAILED at 1.
> 1 out of 1 hunk FAILED -- saving rejects to file a.new.rej
> * cat a.new
> FAILED
> expected:
> two
> three
> got:
> two
> one
> 2 tests (0 passed, 2 failed)
>
> FAIL: symlinks
> ==============
>
> * ln -s f l
> ok
> * patch < create.diff || echo "Status: $?"
> FAILED
> expected:
> File l is not a regular file -- can't patch
> 1 out of 1 hunk ignored -- saving rejects to file l.rej
> Status: 1
> got:
> File l is not a regular file -- can't patch
> ./patch-2.7/src/patch: **** Can't create temporary file ./l.oVcCGDA : Invalid 
> function argument
> Status: 2
> * cat f
> ok
> * ln -s f l
> ok
> * patch < modify.diff || echo "Status: $?"
> FAILED
> expected:
> File l is not a regular file -- can't patch
> 1 out of 1 hunk ignored -- saving rejects to file l.rej
> Status: 1
> got:
> File l is not a regular file -- can't patch
> ./patch-2.7/src/patch: **** Can't create temporary file ./l.oiCjgkU : Invalid 
> function argument
> Status: 2
> * ln -s f l
> ok
> * patch < delete.diff || echo "Status: $?"
> FAILED
> expected:
> File l is not a regular file -- can't patch
> 1 out of 1 hunk ignored -- saving rejects to file l.rej
> Status: 1
> got:
> File l is not a regular file -- can't patch
> ./patch-2.7/src/patch: **** Can't create temporary file ./l.olx81mW : Invalid 
> function argument
> Status: 2
> * patch -p1 < create-symlink.diff || echo "Status: $?"
> ok
> * echo a > target1 && cat symlink
> ok
> * echo b > target1 && cat symlink
> ok
> * patch -p1 < modify-symlink.diff || echo "Status: $?"
> FAILED
> expected:
> patching symbolic link symlink
> got:
> ./patch-2.7/src/patch: **** Can't create temporary file ./symlink.oTJw5jX : 
> Invalid function argument
> Status: 2
> * echo a > target2 && cat symlink
> FAILED
> expected:
> a
> got:
> cat: cannot open symlink
> * echo b > target2 && cat symlink
> FAILED
> expected:
> b
> got:
> cat: cannot open symlink
> * patch -p1 < delete-symlink.diff || echo "Status: $?"
> FAILED
> expected:
> patching symbolic link symlink
> got:
> ./patch-2.7/src/patch: **** Can't create temporary file ./symlink.otlv6CR : 
> Invalid function argument
> Status: 2
> * test ! -L symlink
> FAILED
> * patch -p1 --backup < create-symlink.diff || echo "Status: $?"
> FAILED
> expected:
> patching symbolic link symlink
> got:
> The next patch would create the file symlink,
> which already exists!  Assume -R? [n]
> Apply anyway? [n]
> Skipping patch.
> ./patch-2.7/src/patch: **** Can't create temporary file /tmp/poUilvEh : 
> Invalid function argument
> Status: 2
> * test -f symlink.orig && test ! -s symlink.orig
> FAILED
> * patch -p1 --backup < modify-symlink.diff || echo "Status: $?"
> FAILED
> expected:
> patching symbolic link symlink
> got:
> ./patch-2.7/src/patch: **** Can't create temporary file ./symlink.oGNmIDV : 
> Invalid function argument
> Status: 2
> * echo a > symlink.orig && cat target1
> FAILED
> expected:
> a
> got:
> cat: cannot open target1
> * echo b > symlink.orig && cat target1
> FAILED
> expected:
> b
> got:
> cat: cannot open target1
> * patch -p1 --backup < delete-symlink.diff || echo "Status: $?"
> FAILED
> expected:
> patching symbolic link symlink
> got:
> ./patch-2.7/src/patch: **** Can't create temporary file ./symlink.osxQKXD : 
> Invalid function argument
> Status: 2
> * echo a > symlink.orig && cat target2
> FAILED
> expected:
> a
> got:
> cat: cannot open target2
> * echo b > symlink.orig && cat target2
> FAILED
> expected:
> b
> got:
> cat: cannot open target2
> 23 tests (7 passed, 16 failed)
>
> .patch-2.7/tests $
>
> That error gets generated on 2 places of scr/util.c, pretty close to one 
> another.
>
>   for(;;)
>     {
>       int fd;
>
>       if (gen_tempname (template, 0, flags, GT_NOCREATE))
>         pfatal ("Can't create temporary file %s", template);
>     retry:
>       fd = open (template, O_CREAT | O_EXCL | flags, mode);
>       if (fd == -1)
>         {
>           if (errno == try_makedirs_errno)
>             {
>               makedirs (template);
>               /* FIXME: When patch fails, this may leave around empty
>                  directories.  */
>               try_makedirs_errno = 0;
>               goto retry;
>             }
>           if (errno == EEXIST)
>             continue;
>           pfatal ("Can't create temporary file %s", template);
>         }
>       *name = template;
>       return fd;
>     }
>
> Further testing showed that we hit the 2nd occurrence. Seems the open() 
> doesn't like the mode parameter 0120777, and the S_IFLNK
> part of it in particular, and indeed HP NonStop only supports the file type 
> bits S_IFREG, S_ISVTX and S_SYNC.
>
> Any ideas how to fix it? Is it fixable at all? Should I just ignore that 
> failed test?

We only need to pass the file permissions here. How about this patch?

diff --git a/src/patch.c b/src/patch.c
index febfd42..1c6fb4b 100644
--- a/src/patch.c
+++ b/src/patch.c
@@ -297,7 +297,8 @@ main (int argc, char **argv)

       tmpoutst.st_size = -1;
       outfd = make_tempfile (&TMPOUTNAME, 'o', outname,
-                            O_WRONLY | binary_transput, instat.st_mode);
+                            O_WRONLY | binary_transput,
+                            instat.st_mode & S_IRWXUGO);
       TMPOUTNAME_needs_removal = 1;
       if (diff_type == ED_DIFF) {
        outstate.zero_output = false;

Thanks,
Andreas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]