Hey!

On Tue, 2015-05-19 at 20:39:20 +0200, Mats Erik Andersson wrote:
> Tuesday den 19 May 2015 klockan 08:15 skrev Alfred M. Szmidt detta:
> > We should make a bug fix release to fix this issue for upstream.  I'll
> > do it.
> 
> I want to include a fix needed by FreeBSD 11 for our ifconfig.
> The problem is solved in all my FreeBSD versions, but I need
> to check the other BSD variants during a few hours, before
> making a commit.

I just tracked down a build failure in the Debian GNU/Linux sparc
port, which was due to misaligned memory access. This started to fail
now because I enabled the test suite with that upload.

  
<https://buildd.debian.org/status/fetch.php?pkg=inetutils&arch=sparc&ver=2%3A1.9.3-1&stamp=1431616762>

Unfortunately I missed passing VERBOSE=1 to the make call, so it does
not report the test suite failure details, but that will be fixed in
the next upload too.

I checked the glibc FTS implementation and lifted the alignment parts,
attached is a quikc patch that fixes the issue on such systems,
sending it now to try to not miss the new upstream release.

Thanks,
Guillem
---
 libls/fts.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

--- a/libls/fts.c
+++ b/libls/fts.c
@@ -59,6 +59,17 @@
 
 #include "fts.h"
 
+/* Largest alignment size needed, minus one.
+ *    Usually long double is the worst case.  */
+#ifndef ALIGNBYTES
+#define ALIGNBYTES	(__alignof__ (long double) - 1)
+#endif
+/* Align P to that size.  */
+#ifndef ALIGN
+#define ALIGN(p)	(((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
+#endif
+
+
 static FTSENT *fts_alloc (FTS *, const char *, int);
 static FTSENT *fts_build (FTS *, int);
 static void fts_lfree (FTSENT *);
@@ -1000,7 +1011,7 @@ fts_alloc (FTS *sp, const char *name, re
    */
   len = sizeof (FTSENT) + namelen;
   if (!ISSET (FTS_NOSTAT))
-    len += sizeof (struct stat);
+    len += sizeof (struct stat) + ALIGNBYTES;
   if ((p = malloc (len)) == NULL)
     return (NULL);
 
@@ -1008,7 +1019,7 @@ fts_alloc (FTS *sp, const char *name, re
   memmove (p->fts_name, name, namelen + 1);
 
   if (!ISSET (FTS_NOSTAT))
-    p->fts_statp = (struct stat *) (p->fts_name + namelen + 2);
+    p->fts_statp = (struct stat *) ALIGN (p->fts_name + namelen + 2);
   p->fts_namelen = namelen;
   p->fts_path = sp->fts_path;
   p->fts_errno = 0;

Reply via email to