From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manolis Ragkousis Subject: bug#30547: Hurd patch for `patch` does not apply to latest release Date: Tue, 20 Feb 2018 17:31:50 +0200 Message-ID: <57c572ba-a7d2-b617-9549-3d01e14cbe4d@gmail.com> References: <20180220122034.GA26373@jasmine.lan> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------193D56755F5537B3F5D24FB3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo9uh-0001Nd-3B for bug-guix@gnu.org; Tue, 20 Feb 2018 10:33:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo9ug-0000zY-2h for bug-guix@gnu.org; Tue, 20 Feb 2018 10:33:03 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:45149) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eo9uf-0000zS-Uy for bug-guix@gnu.org; Tue, 20 Feb 2018 10:33:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eo9uf-0003b4-Ob for bug-guix@gnu.org; Tue, 20 Feb 2018 10:33:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo9tc-0000bX-D9 for bug-guix@gnu.org; Tue, 20 Feb 2018 10:32:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo9tb-0000hs-Dl for bug-guix@gnu.org; Tue, 20 Feb 2018 10:31:56 -0500 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:43127) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eo9tb-0000ge-55 for bug-guix@gnu.org; Tue, 20 Feb 2018 10:31:55 -0500 Received: by mail-wr0-x232.google.com with SMTP id u49so10902176wrc.10 for ; Tue, 20 Feb 2018 07:31:54 -0800 (PST) In-Reply-To: <20180220122034.GA26373@jasmine.lan> Content-Language: en-US List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: leo@famulari.name, 30547@debbugs.gnu.org This is a multi-part message in MIME format. --------------193D56755F5537B3F5D24FB3 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Hello Leo, On 02/20/18 14:20, Leo Famulari wrote: > There is a new version of GNU Patch, 2.7.6: > > https://ftp.gnu.org/gnu/patch/ > > I noticed that our patch, 'patch-hurd-path-max.patch', doesn't apply. I > have an idea of how to adapt the patch, but I don't really have a way to > test it. > > Manolis, are you able to adapt the patch to Patch 2.7.6? > I rebased the patch on the latest patch master. The only thing I am not sure is why the old patch was changing PATH_MAX with tost->st_size + 1. I can't remember for the life of me. Also I can't remember why this patch isn't part of patch upstream yet. The old diff - char *buffer = xmalloc (PATH_MAX); + char *buffer = xmalloc (tost->st_size + 1); while now I made it: - char *buffer = xmalloc (PATH_MAX + 1); + char *buffer = xmalloc (tost->st_size + 2); Anyhow it should work now, can you try it? Thank you! Manolis --------------193D56755F5537B3F5D24FB3 Content-Type: text/x-patch; name="patch-hurd-path-max.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-hurd-path-max.patch" diff --git a/src/util.c b/src/util.c index 1cc08ba..eee8514 100644 --- a/src/util.c +++ b/src/util.c @@ -460,12 +460,12 @@ move_file (char const *from, bool *from_needs_removal, /* FROM contains the contents of the symlink we have patched; need to convert that back into a symlink. */ - char *buffer = xmalloc (PATH_MAX); + char *buffer = xmalloc (fromst->st_size + 1); int fd, size = 0, i; if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0) pfatal ("Can't reopen file %s", quotearg (from)); - while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0) + while ((i = read (fd, buffer + size, fromst->st_size - size)) > 0) size += i; if (i != 0 || close (fd) != 0) read_fatal (); @@ -610,10 +610,10 @@ copy_file (char const *from, char const *to, struct stat *tost, if (S_ISLNK (mode)) { - char *buffer = xmalloc (PATH_MAX + 1); + char *buffer = xmalloc (tost->st_size + 2); ssize_t r; - if ((r = safe_readlink (from, buffer, PATH_MAX)) < 0) + if ((r = safe_readlink (from, buffer, tost->st_size)) < 0) pfatal ("Can't read %s %s", "symbolic link", from); buffer[r] = '\0'; if (safe_symlink (buffer, to) != 0) --------------193D56755F5537B3F5D24FB3--