found 754792 20140105-1
thanks

On Thu, 2014-08-21 at 21:36 +0200, Pierre Chifflier wrote:
> On Mon, Jul 14, 2014 at 01:15:26PM +0200, Svante Signell wrote:
> > Source: libbfio
> > Version: 20130507-1
> > Severity: important
> > Tags: patch
> > User: debian-h...@lists.debian.org
> > Usertags: hurd
> > 
> > Hello,
> > 
> > libbfio fails to build from source due to usage of PATH_MAX,which is not
> > defined on GNU/Hurd. The attached patch fixes usage of PATH_MAX as
> > second argument to getcwd() by using calls to getcwd (NULL, 0) instead.
> > Supporting (NULL, 0) as arguments is an extension to POSIX.1-2001 for
> > libc4, libc5 and glibc, so most modern systems have it. In order to
> > simplify the patch, only this version is implemented.
> 
> Hi Svante,
> 
> I just uploaded new upstream versions for libbfio and libewf.
> 
> Unfortunately, the patches you sent no longer apply, since the code has
> changed. I had a quick look, but could not determine what would be the
> proper way to fix the build on hurd (and probably kfreebsd).
> If you have some time to look at the new version, it would be great so
> the package could be fixed before the release.
> 
> Here are a few more comments/questions on the patch:
> 
> 
> > Index: libbfio-20130507/libcpath/libcpath_path.c
> > ===================================================================
> > --- libbfio-20130507.orig/libcpath/libcpath_path.c
> > +++ libbfio-20130507/libcpath/libcpath_path.c
> > @@ -356,9 +356,6 @@ int libcpath_path_get_current_working_di
> >     }
> >  #if defined( WINAPI )
> >     *current_working_directory_size = (size_t) _MAX_PATH;
> > -#else
> > -   *current_working_directory_size = (size_t) PATH_MAX;
> > -#endif
> >     *current_working_directory = libcstring_narrow_string_allocate(
> >                                   *current_working_directory_size );
> >  
> 
> If I understand correctly, current_working_directory_size is now
> uninitialized ? Shouldn't it be set to 0 explicitly ?

This no longer applies, see the attached updated patch.

> 
> > @@ -387,7 +384,6 @@ int libcpath_path_get_current_working_di
> > +   *current_working_directory = getcwd (NULL, 0);
> 
> The getcwd manpage says that the allocation of memory is an extension to
> the POSIX.1-2001 standard, so it seems Linux-specific. Will this cause
> any problem on other platforms (I suppose Hurd is OK, but what about
> kFreeBSD ?).

Support for getcwd (NULL, 0) is available in all glibc-based
distributions. That includes at least Linux, kFreeBSD and Hurd.

Attached is also a build dependency on quilt in debian/control. I don't
know if this is strictly needed, but is included for completeness. The
source directory does not have a debian/patches directory since no
patches are present currently. However, the source format is 3.0
(quilt).

Thanks!
--- a/debian/control.orig	2014-08-21 14:09:34.000000000 +0200
+++ b/debian/control	2014-08-25 10:28:01.000000000 +0200
@@ -2,7 +2,7 @@
 Priority: optional
 Maintainer: Debian Forensics <forensics-de...@lists.alioth.debian.org>
 Uploaders: Pierre Chifflier <pol...@debian.org>
-Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config
+Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config, quilt
 Standards-Version: 3.9.5
 Section: libs
 Homepage: http://code.google.com/p/libbfio/
--- a/libcpath/libcpath_path.c.orig	2014-01-05 18:29:04.000000000 +0100
+++ b/libcpath/libcpath_path.c	2014-08-25 10:15:50.000000000 +0200
@@ -327,6 +327,7 @@
 
 		return( -1 );
 	}
+
 	if( current_working_directory_size == NULL )
 	{
 		libcerror_error_set(
@@ -338,40 +339,12 @@
 
 		return( -1 );
 	}
-	*current_working_directory_size = (size_t) PATH_MAX;
-
-	*current_working_directory = libcstring_narrow_string_allocate(
-	                              *current_working_directory_size );
 
+	*current_working_directory = getcwd(
+					    NULL,
+					    0 );
 	if( *current_working_directory == NULL )
 	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( memory_set(
-	     *current_working_directory,
-	     0,
-	     sizeof( char ) * *current_working_directory_size ) == NULL )
-	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
-		 "%s: unable to clear current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     *current_working_directory,
-	     *current_working_directory_size ) == NULL )
-	{
 		libcerror_system_set_error(
 		 error,
 		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
@@ -382,6 +355,8 @@
 
 		goto on_error;
 	}
+	*current_working_directory_size = 1 + libcstring_narrow_string_length(
+									      *current_working_directory );
 	return( 1 );
 
 on_error:
@@ -3036,23 +3011,10 @@
 
 		return( -1 );
 	}
-	narrow_current_working_directory = libcstring_narrow_string_allocate(
-	                                    PATH_MAX );
-
-	if( narrow_current_working_directory == NULL )
-	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create narrow current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     narrow_current_working_directory,
-	     PATH_MAX ) == NULL )
+	narrow_current_working_directory = getcwd(
+						  NULL,
+						  0 );
+	if( narrow_current_working_directory == NULL)
 	{
 		libcerror_system_set_error(
 		 error,

Reply via email to