[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: m4 didn't work with files in FAT system on Mac OS

From: Eric Blake
Subject: Re: m4 didn't work with files in FAT system on Mac OS
Date: Wed, 30 Apr 2014 22:31:48 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/30/2014 10:10 PM, 光先邹 wrote:

> The reason is st_ino of empty file in FAT system is 999999999, which will
> lead debug set back to stdout in function debug_set_file. Here is a patch
> which will resolve this problem.

Thanks for the report.  However, I'd rather you get the filesystem bug
fixed rather than trying to patch lots of individual programs that are
all negatively impacted by the filesystem bug.

> % diff -u  m4-1.4.17.orig/src/debug.c m4-1.4.17/src/debug.c
> --- m4-1.4.17.orig/src/debug.c 2013-09-22 13:50:43.000000000 +0800
> +++ m4-1.4.17/src/debug.c 2014-05-01 11:55:41.000000000 +0800
> @@ -23,6 +23,8 @@

Your patch came through with whitespace munging; any chance you can
convince your mailer to send it in a way that won't be corrupted in transit?

> #include <stdarg.h>
> #include <sys/stat.h>
> +#include <sys/param.h>
> +#include <sys/mount.h>

These files are not POSIX, and therefore cannot be expected to exist on
all platforms.  To use them, you'd first have to add configure.ac checks
on whether they exist.

> +          if(debug_stat.st_ino == 999999999)

Style: space before (

> +          {
> +            struct statfs sfsb;
> +            if(fstatfs(fileno (debug), &sfsb) == 0)

and again

> +            {
> +              if (strcasecmp(sfsb.f_fstypename, "msdos") == 0

and again.

f_fstypename is not a portable member of struct statfs; more configure
checks are required.  In fact, fstatfs() is not portable; POSIX only
requires fstatvfs().  I need more details about your setup - which
kernel are you using, and which version of the fat filesystem?

Again, this feels too hacky to include in m4 proper; the real bug is in
the file system for violating POSIX semantics on returning an inode
number that reliably determines a unique file.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]