bug-bash
[Top][All Lists]
Advanced

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

Re: obscure bug "extern void free (void *__ptr) __attribute__ ((__nothro


From: Mathias Steiger
Subject: Re: obscure bug "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));"
Date: Fri, 22 Jan 2021 16:59:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1


I am ashamed to say, /dev/null being a regular file was the source of the problem.


Actually this was one of the very first ideas I had and I tested against it in multiple ways. I ran:

echo asdf > /dev/null ; cat /dev/null and cat /dev/null

several times, always returning empty. It must have been freak chance. I mistook the output of "file /dev/null" to name a /dev/null empty device rather than an empty file of that name. Also this has happened to me a couple of times before, and in the past it always caused very obvious problems on the entire system.

I am sorry for the inconvenience.


Best regards,

Mathias

On 1/22/21 3:09 PM, Chet Ramey wrote:
On 1/22/21 2:53 AM, Eduardo A. Bustamante López wrote:

- Notice that the value returned by `fstat(0, ...)' indicates that /dev/null in your system is a *regular* file (it should be `st_mode=S_IFCHR|0666', but instead it is `st_mode=S_IFCHR|0666'). It also indicates that its size is 73 bytes (`st_size=73'). - Notice that `cat' reads from file descriptor 0 (i.e. /dev/null), and the return value is a string of 73 bytes in length.
- `cat' then writes that string out to `./config.status'

73 happens to be the length of the string that has been causing issues for you:

   $ echo "extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));" | wc -c
   73

This is a first-class observation.




reply via email to

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