Updating dpkg-buildflags to enable reproducible=+fixfilepath by default

Lisandro Damián Nicanor Pérez Meyer perezmeyer at gmail.com
Sat Jan 9 20:47:09 GMT 2021


Hi!

On Sat, 9 Jan 2021 at 16:52, Mattia Rizzolo <mattia at debian.org> wrote:
>
> On Sat, Jan 09, 2021 at 08:37:48PM +0100, Samuel Thibault wrote:
> > Lisandro Damián Nicanor Pérez Meyer, le sam. 09 janv. 2021 15:53:41 -0300, a ecrit:
> > > # __FILE__ is a public, well defined API
> >
> > ? My copy of C11 says
> >
> > “
> > __FILE__ The presumed name of the current source file (a character string literal)
> > ”
> >
> > that's not so well-defined.  I would not expect it to necessarily
> > contain the path to it.
>
> In fact, empirically I've seen that __FILE__ is expanded to whatever
> path gets passed to the compiler.
> You can easily see how stuff build with cmake get a full path in there,
> whereas stuff built with make gets a path relative to the Makefile.

Mattias has just showed me that in fact __FILE__ is too malleable:

mattia at warren /tmp/tmp % cat test.c
#include <stdio.h>
int main() {
    printf("%s\n", __FILE__);
}

mattia at warren /tmp/tmp % gcc test.c ; ./a.out
test.c
mattia at warren /tmp/tmp % gcc ./test.c ; ./a.out
./test.c
mattia at warren /tmp/tmp % gcc /tmp/tmp/./test.c ; ./a.out
/tmp/tmp/./test.c

So yes, the cornerstone of my assumption was totally wrong. My
apologies for all the noise, all I can say is: today I learned
something new.




-- 
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/



More information about the Reproducible-builds mailing list