[cl-debian] Bug#410374: ecl: depends on MAXPATHLEN or PATH_MAX being defined
Pierre THIERRY
nowhere.man at levallois.eu.org
Sat Feb 10 08:56:42 UTC 2007
Package: ecl
Version: 0.9i-2
Severity: important
Tags: patch
Justification: fails to build from source
ECL throws an error during compilation if neither MAXPATHLEN nor
PATH_MAX are defined, though POSIX explicitely permits those constants
to be undefined. Applications should test for their definition and if
needed use sysconf() to get the actual value.
As neither constant is defined on Hurd, ECL wouldn't build at all.
Here is a preliminary (and rather unintrusive) patch that doesn't check
at runtime for the limit but enable building ECL:
diff -r 045b9347e44a src/c/pathname.d
--- a/src/c/pathname.d Tue Feb 06 17:36:54 2007 +0100
+++ b/src/c/pathname.d Sat Feb 10 06:27:50 2007 +0100
@@ -29,8 +29,8 @@
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
-# else
-# error "Either MAXPATHLEN or PATH_MAX should be defined"
+//# else
+//# error "Either MAXPATHLEN or PATH_MAX should be defined"
# endif
#endif
@@ -754,8 +754,10 @@ si_coerce_to_filename(cl_object pathname
FEerror("Pathname ~A does not have a physical namestring",
1, pathname_orig);
}
+#ifdef MAXPATHLEN
if (namestring->base_string.fillp >= MAXPATHLEN - 16)
FEerror("Too long filename: ~S.", 1, namestring);
+#endif
return namestring;
}
diff -r 045b9347e44a src/c/unixfsys.d
--- a/src/c/unixfsys.d Tue Feb 06 17:36:54 2007 +0100
+++ b/src/c/unixfsys.d Sat Feb 10 06:38:53 2007 +0100
@@ -49,8 +49,8 @@
#ifndef MAXPATHLEN
# ifdef PATH_MAX
# define MAXPATHLEN PATH_MAX
-# else
-# error "Either MAXPATHLEN or PATH_MAX should be defined"
+//# else
+//# error "Either MAXPATHLEN or PATH_MAX should be defined"
# endif
#endif
@@ -247,7 +247,15 @@ FILE *
FILE *
backup_fopen(const char *filename, const char *option)
{
+#ifdef MAXPATHLEN
char backupfilename[MAXPATHLEN];
+#else
+ char *backupfilename = malloc(strlen(filename) + 5);
+ if (backupfilename == NULL) {
+ // not sure how allocation failure should be dealt with
+ FElibc_error("Cannot allocate memory for backup filename", 0);
+ }
+#endif
strcat(strcpy(backupfilename, filename), ".BAK");
#ifdef _MSC_VER
@@ -258,6 +266,9 @@ backup_fopen(const char *filename, const
if (rename(filename, backupfilename))
FElibc_error("Cannot rename the file ~S to ~S.", 2,
make_constant_base_string(filename), make_simple_base_string(backupfilename));
+#ifndef MAXPATHLEN
+ free(backupfilename);
+#endif
return fopen(filename, option);
}
-- System Information:
Debian Release: 4.0
APT prefers testing
APT policy: (990, 'testing'), (501, 'stable'), (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-2-k7
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Versions of packages ecl depends on:
ii common-lisp-controller 6.9 This is a Common Lisp source and c
ii gcc-4.1 4.1.1-21 The GNU C compiler
ii libc6 2.3.6.ds1-10 GNU C Library: Shared libraries
ii libgc-dev 1:6.8-1 conservative garbage collector for
ii libgc1c2 1:6.8-1 conservative garbage collector for
ii libgmp3-dev 2:4.2.1+dfsg-4 Multiprecision arithmetic library
ii libgmp3c2 2:4.2.1+dfsg-4 Multiprecision arithmetic library
ii libncurses5-dev 5.5-5 Developer's libraries and docs for
ecl recommends no packages.
-- no debconf information
--
nowhere.man at levallois.eu.org
OpenPGP 0xD9D50D8A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://mailman.common-lisp.net/pipermail/cl-debian/attachments/20070210/cbff581f/attachment.sig>
More information about the Cl-debian
mailing list