gnu: less: Build fix for the Hurd.

* gnu/packages/patches/less-hurd-path-max.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/less.scm (less): Use it.
This commit is contained in:
Jan Nieuwenhuizen 2020-03-07 14:55:35 +01:00
parent d0ed201e0a
commit 7baa8c7898
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
3 changed files with 40 additions and 0 deletions

View file

@ -1110,6 +1110,7 @@ dist_patch_DATA = \
%D%/packages/patches/ldc-bootstrap-disable-tests.patch \
%D%/packages/patches/ldc-disable-phobos-tests.patch \
%D%/packages/patches/leela-zero-gtest.patch \
%D%/packages/patches/less-hurd-path-max.patch \
%D%/packages/patches/liba52-enable-pic.patch \
%D%/packages/patches/liba52-link-with-libm.patch \
%D%/packages/patches/liba52-set-soname.patch \

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -19,6 +20,7 @@
(define-module (gnu packages less)
#:use-module (guix licenses)
#:use-module (gnu packages)
#:use-module (gnu packages ncurses)
#:use-module (guix packages)
#:use-module (guix download)
@ -35,6 +37,7 @@ (define-public less
version ".tar.gz")
(string-append "http://www.greenwoodsoftware.com/less/less-"
version ".tar.gz")))
(patches (search-patches "less-hurd-path-max.patch"))
(sha256
(base32 "0ggyjl3yzn7c450zk1rixi9ls6asdhgqynhk34zsd0ckhmsm45pz"))))
(build-system gnu-build-system)

View file

@ -0,0 +1,36 @@
Avoid usage of PATH_MAX.
Submitted to bug-less@gnu.org.
From ef652341ed8b2c14ac40312ccd4ed329cb69fd0c Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sat, 7 Mar 2020 14:57:19 +0100
Subject: [PATCH] Avoid usage of PATH_MAX.
* filename.c (lrealpath): Have realpath allocate the buffer. Fixes
compilation on the Hurd and avoids possible buffer overflow on other
systems.
---
filename.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/filename.c b/filename.c
index e420837..faa71b0 100644
--- a/filename.c
+++ b/filename.c
@@ -795,9 +795,9 @@ lrealpath(path)
char *path;
{
#if HAVE_REALPATH
- char rpath[PATH_MAX];
- if (realpath(path, rpath) != NULL)
- return (save(rpath));
+ char *rpath = NULL;
+ if ((rpath = realpath(path, rpath)) != NULL)
+ return (rpath);
#endif
return (save(path));
}
--
2.24.0