Your message dated Sat, 01 Feb 2025 16:10:02 +0000
with message-id <[email protected]>
and subject line Bug#744847: fixed in dwarves 1.29-2
has caused the Debian Bug report #744847,
regarding dwarves-dfsg: FTBFS on hurd-i386
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
744847: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=744847
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: dwarves-dfsg
Version: 1.10-2
Severity: important
Tags: patch
User: [email protected]
Usertags: hurd

Hi,

Currently dwarves-dfsg fails to build from source due to PATH_MAX being
used, and that constant is not defined on GNU/Hurd. The attached patch
avoid using PATH_MAX by allocating strings with malloc and free them when
not needed any longer. 

Thanks!

--- a/dwarves.c
+++ b/dwarves.c
@@ -1365,33 +1365,48 @@ int cus__load_dir(struct cus *self, stru
 
 	err = 0;
 	while ((entry = readdir(dir)) != NULL) {
-		char pathname[PATH_MAX];
+		char *pathname;
+		size_t len;
 		struct stat st;
 
 		if (strcmp(entry->d_name, ".") == 0 ||
 		    strcmp(entry->d_name, "..") == 0)
 		    continue;
 
-		snprintf(pathname, sizeof(pathname), "%s/%s",
+		len = strlen(dirname) + 1 + strlen(entry->d_name) + 1;
+		pathname = malloc(len);
+		if (pathname == NULL) {
+			 err = -1;
+			 break;
+		}
+		snprintf(pathname, len, "%s/%s",
 			 dirname, entry->d_name);
 
 		err = lstat(pathname, &st);
-		if (err != 0)
+		if (err != 0) {
+		  	free(pathname);
 			break;
+		}
 
 		if (S_ISDIR(st.st_mode)) {
-			if (!recursive)
+			if (!recursive) {
+				free(pathname);
 				continue;
-
+			}
 			err = cus__load_dir(self, conf, pathname,
 					    filename_mask, recursive);
-			if (err != 0)
+			if (err != 0) {
+		  		free(pathname);
 				break;
+			}
 		} else if (fnmatch(filename_mask, entry->d_name, 0) == 0) {
 			err = cus__load_file(self, conf, pathname);
-			if (err != 0)
+			if (err != 0) {
+		  		free(pathname);
 				break;
+			}
 		}
+		free(pathname);
 	}
 
 	if (err == -1)
--- a/libctf.c
+++ b/libctf.c
@@ -723,26 +723,46 @@ found_SUNW_ctf_str:
 	gelf_update_shdr(newscn, &shdr_mem);
 	elf_flagshdr(newscn, ELF_C_SET, ELF_F_DIRTY);
 #else
-	char pathname[PATH_MAX];
-	snprintf(pathname, sizeof(pathname), "%s.SUNW_ctf", self->filename);
+	size_t len;
+	char *pathname;
+	static const char *ctf_name = ".SUNW_ctf";
+
+	len = strlen(self->filename) + strlen(ctf_name) + 1;
+	pathname = malloc(len);
+	if (pathname == NULL)
+	  goto out_close;
+	snprintf(pathname, len, "%s%s", self->filename, ctf_name);
 	fd = creat(pathname, S_IRUSR | S_IWUSR);
 	if (fd == -1) {
 		fprintf(stderr, "%s: open(%s) failed!\n", __func__, pathname);
+		free(pathname);
 		goto out_close;
 	}
-	if (write(fd, bf, size) != size)
+	if (write(fd, bf, size) != size) {
+		free(pathname);
 		goto out_close;
+	}
 
 	if (close(fd) < 0)
 		goto out_unlink;
 
-	char cmd[PATH_MAX];
-	snprintf(cmd, sizeof(cmd), "objcopy --add-section .SUNW_ctf=%s %s",
+	char *cmd;
+	static const char *ctf_command = "objcopy --add-section ";
+
+	len = strlen(ctf_command) + strlen(ctf_name) + 1 +
+		strlen(pathname) + 1 + strlen(self->filename) + 1;
+	cmd = malloc(len);
+	if (cmd == NULL)
+		goto out_unlink;
+
+	snprintf(cmd, len, "%s%s=%s %s", ctf_command, ctf_name,
 		 pathname, self->filename);
 	if (system(cmd) == 0)
 		err = 0;
+	free(cmd);
 out_unlink:
 	unlink(pathname);
+	free(pathname);
 	return err;
 #endif
 out_update:
--- a/ctracer.c
+++ b/ctracer.c
@@ -965,13 +965,14 @@ static struct argp ctracer__argp = {
 int main(int argc, char *argv[])
 {
 	int remaining, err;
+	size_t len;
 	struct tag *class;
 	struct cu *cu;
 	char *filename;
-	char functions_filename[PATH_MAX];
-	char methods_filename[PATH_MAX];
-	char collector_filename[PATH_MAX];
-	char classes_filename[PATH_MAX];
+	char *functions_filename = NULL;
+	char *methods_filename = NULL;
+	char *collector_filename = NULL;
+	char *classes_filename = NULL;
 	struct structure *pos;
 	FILE *fp_functions;
 	int rc = EXIT_FAILURE;
@@ -1048,8 +1049,17 @@ failure:
 		goto out;
 	}
 
-	snprintf(functions_filename, sizeof(functions_filename),
-		 "%s/%s.functions", src_dir, class__name(tag__class(class), cu));
+	static const char *functions_ext = ".functions";
+	len = strlen(src_dir) + 1 +
+		strlen(class__name(tag__class(class), cu)) +
+		strlen(functions_ext) + 1;
+	functions_filename = malloc(len);
+	if (functions_filename == NULL) {
+		fprintf(stderr, "ctracer: malloc failed allocating space for functions_filename\n");
+		goto out;
+	}
+	snprintf(functions_filename, len, "%s/%s%s",
+		src_dir, class__name(tag__class(class), cu), functions_ext);
 	fp_functions = fopen(functions_filename, "w");
 	if (fp_functions == NULL) {
 		fprintf(stderr, "ctracer: couldn't create %s\n",
@@ -1057,8 +1067,15 @@ failure:
 		goto out;
 	}
 
-	snprintf(methods_filename, sizeof(methods_filename),
-		 "%s/ctracer_methods.stp", src_dir);
+	static const char *methods_name = "ctracer_methods.stp";
+	len = strlen(src_dir) + 1 + strlen(methods_name) + 1;
+	methods_filename = malloc(len);
+	if (methods_filename == NULL) {
+		fprintf(stderr, "ctracer: malloc failed allocating space for methods_filename\n");
+		goto out;
+	}
+	snprintf(methods_filename, len,
+		 "%s/%s", src_dir, methods_name);
 	fp_methods = fopen(methods_filename, "w");
 	if (fp_methods == NULL) {
 		fprintf(stderr, "ctracer: couldn't create %s\n",
@@ -1066,8 +1083,15 @@ failure:
 		goto out;
 	}
 
-	snprintf(collector_filename, sizeof(collector_filename),
-		 "%s/ctracer_collector.c", src_dir);
+	static const char *collector_name = "ctracer_collector.c";
+	len = strlen(src_dir) + 1 + strlen(collector_name) + 1;
+	collector_filename = malloc(len);
+	if (collector_filename == NULL) {
+		fprintf(stderr, "ctracer: malloc failed allocating space for collector_filename\n");
+		goto out;
+	}
+	snprintf(collector_filename, len,
+		 "%s/%s", src_dir, collector_name);
 	fp_collector = fopen(collector_filename, "w");
 	if (fp_collector == NULL) {
 		fprintf(stderr, "ctracer: couldn't create %s\n",
@@ -1075,8 +1099,15 @@ failure:
 		goto out;
 	}
 
-	snprintf(classes_filename, sizeof(classes_filename),
-		 "%s/ctracer_classes.h", src_dir);
+	static const char *classes_name = "ctracer_classes.h";
+	len = strlen(src_dir) + 1 + strlen(classes_name) + 1;
+	classes_filename = malloc(len);
+	if (classes_filename == NULL) {
+		fprintf(stderr, "ctracer: malloc failed allocating space for classes_filename\n");
+		goto out;
+	}
+	snprintf(classes_filename, len,
+		 "%s/%s", src_dir, classes_name);
 	fp_classes = fopen(classes_filename, "w");
 	if (fp_classes == NULL) {
 		fprintf(stderr, "ctracer: couldn't create %s\n",
@@ -1144,6 +1175,10 @@ failure:
 
 	rc = EXIT_SUCCESS;
 out:
+	free(functions_filename);
+	free(methods_filename);
+	free(collector_filename);
+	free(classes_filename);
 	cus__delete(methods_cus);
 	dwarves__exit();
 	return rc;

--- End Message ---
--- Begin Message ---
Source: dwarves
Source-Version: 1.29-2
Done: Domenico Andreoli <[email protected]>

We believe that the bug you reported is fixed in the latest version of
dwarves, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Domenico Andreoli <[email protected]> (supplier of updated dwarves package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 01 Feb 2025 14:50:53 +0100
Source: dwarves
Architecture: source
Version: 1.29-2
Distribution: unstable
Urgency: medium
Maintainer: Domenico Andreoli <[email protected]>
Changed-By: Domenico Andreoli <[email protected]>
Closes: 744847
Changes:
 dwarves (1.29-2) unstable; urgency=medium
 .
   * Build only on Linux, other OSes require major changes.
     Closes: #744847.
   * Forwarded patches upstream.
Checksums-Sha1:
 225a0d4551f1ebb2506fec551e40e46182892596 2186 dwarves_1.29-2.dsc
 2dbcbf50a7c09e30d7567dec3223d1557abb9789 20944 dwarves_1.29-2.debian.tar.xz
 52f3c9cacc14950f9e1a95581c1546828c0f83d1 8170 dwarves_1.29-2_arm64.buildinfo
Checksums-Sha256:
 e51b01d778f18596a333cbebda21b0149d0d2e6d447269fc6247361e61ed32f8 2186 
dwarves_1.29-2.dsc
 20959161bad77e6d45dddb6fb0b304a31ab67d47943fadf7dc284db83aaf2c22 20944 
dwarves_1.29-2.debian.tar.xz
 9d1bb295cf9a9dcdd95321286d6087324c46ec947f848c997220ac882fbad879 8170 
dwarves_1.29-2_arm64.buildinfo
Files:
 715a59581ff1a5dd001db9572c8e63ca 2186 utils optional dwarves_1.29-2.dsc
 48d7f5d43129a50cc597621b4155fb80 20944 utils optional 
dwarves_1.29-2.debian.tar.xz
 d17a4cf892f4dca268c3454190a334d1 8170 utils optional 
dwarves_1.29-2_arm64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEEGSWGdoKrcEzTtUezikr1XMf+zOIFAmeePpYRHGNhdm9rQGRl
Ymlhbi5vcmcACgkQikr1XMf+zOLYQg//SXy0DGOHY5kxJrNs1qohhJ111AhIdv5B
HUDqRX24zFsXP0QCBORgjf3SZWRbTvs34KVRKdfzcVrsBjwFb19jDLcgBdD+ko8P
V8hp6gpP8/Pn4SUjKH9cq2u3G2Zjv+MJD1/uFV37C00xIbV64XLblRtY6+Gd+h5t
Ze4WJYP5QJEG6uMcrJjQ0xUB7L0BPwq76JrkMpYAf1+CqjQZDk2zAvP6Mv8JWqGX
6WIiWEde0oAPtnIroUCnCB5CEjX1qq89G4MQMs6wpM4245PBCLNgaGgP2aojJuyB
TsBoMnsAuRvfIhulg7x9eAIvFKwmvWMO3AVv2/7ZYXbm3SmbCoHdLoF4UZRPPc9c
ouj83WquP52Ox9GsTslffNCKSRcTS0KLvo/tNcDFz4LTm4YmLei8ak+JPjJX8qPN
k7hrzDY9dm0l2FdiiIvs5IAt7NwhQP6ltgx6Vt/UGYdAB6ewLHFBye/7csWRNaQR
HugwlXNDbXJc4PU+VjN8tQLKSq+v1bGgLbbXZax6EsNRNa/YQdHf81bs6alVyh7l
EC2OgqMF2Tf5K6DF4JgNqYNwfvL84WDD2/aaegaa5tYqPjK47Nk6WzDFuHuOAlKY
ZfzDdr+zm1mJJzMAhwvnYb+5UHPl6u1l8wOoJrzxBv6+qTGtQK7xBSutqRhnLmbR
On8o5ziC+aY=
=eP2H
-----END PGP SIGNATURE-----

Attachment: pgpHLjt2XuACp.pgp
Description: PGP signature


--- End Message ---

Reply via email to