[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stat(1) on Solaris 9
From: |
Jim Meyering |
Subject: |
Re: stat(1) on Solaris 9 |
Date: |
Fri, 23 Oct 2009 14:19:55 +0200 |
Eric Blake wrote:
> According to Jim Meyering on 10/22/2009 4:14 AM:
>>>> exposes the bug. Why? Because our replacement <sys/stat.h> declares stat
>>>> as an object-like macro, but stat(1) had a usage pattern that hid rpl_stat
>>>> from view and directly called the buggy stat. OK to commit?
>>> Good catch. Please do.
>>>
>>>> Also, I'm reattaching the stdbuf readlink() cleanup patch from a few days
>>>> ago; I've now tested it on Linux. What file contains maintainer syntax
>>>> checks to ensure we don't reintroduce raw '\breadlink(at)?' or 'stat :'?
>>> cfg.mk is where I've been putting coreutils-specific syntax checks.
>>
>> Here's part of it:
>>
>>>From cbf36952d8c227aa5e46acf8643458a7fd51d473 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <address@hidden>
>> Date: Thu, 22 Oct 2009 12:12:24 +0200
>> Subject: [PATCH] build: prohibit direct use of readlink or readlinkat
>
> How about this for the other part?
...
> Subject: [PATCH] build: prohibit improper use of stat and lstat
>
> * cfg.mk (sc_prohibit_stat_macro_address): New rule.
> * src/ln.c (do_link): Adjust comment to avoid rule.
> * src/stat.c (do_stat): Likewise.
> * src/touch.c (main): Likewise.
Thanks! At first I was going to object, thinking you'd
changed code formatting, rather than code-in-comment.
This looks fine. Obfuscating code in comments is much
better than exempting those entire files.
> cfg.mk | 6 ++++++
> src/ln.c | 2 +-
> src/stat.c | 2 +-
> src/touch.c | 2 +-
> 4 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/cfg.mk b/cfg.mk
> index 807d3c9..79f8066 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -197,6 +197,12 @@ sc_prohibit_readlink:
> msg='do not use readlink(at); use via xreadlink or areadlink*' \
> $(_prohibit_regexp)
>
> +# Don't use address of "stat" or "lstat" functions
> +sc_prohibit_stat_macro_address:
> + @re='stat '':|&l?stat\>' \
How about \<l?stat, so we don't mistakenly match something like
"not_stat :"?
> + msg='stat() and lstat() may be function-like macros' \
> + $(_prohibit_regexp)