NetBSD Problem Report #55802

From gson@gson.org  Wed Nov 11 12:30:49 2020
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 007361A923A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 11 Nov 2020 12:30:48 +0000 (UTC)
Message-Id: <20201111123044.3370D253DC1@guava.gson.org>
Date: Wed, 11 Nov 2020 14:30:44 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: Reproducible builds aren't
X-Send-Pr-Version: 3.95

>Number:         55802
>Category:       misc
>Synopsis:       Reproducible builds aren't
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 11 12:35:00 +0000 2020
>Last-Modified:  Mon Nov 16 09:05:01 +0000 2020
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current
>Organization:
>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:

If I download, install, and boot a daily build, for example

  http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202011092220Z/amd64/

including the debug and source sets, when I try to debug a userland
program using gdb, it fails to find the sources:

  # gdb sync
  (gdb) l main
  47      /home/source/ab/HEAD/src/bin/sync/sync.c: No such file or directory.

According to /etc/release, this is a MKREPRO build, so it shouldn't
contain any references to paths on the build system such as the
/home/source/ab/HEAD path above.

>How-To-Repeat:

install misc/py-anita 2.8 and emulators/qemu from pkgsrc

anita --disk-size 10G --memory-size 256M --sets kern-GENERIC,modules,base,etc,comp,games,man,misc,tests,text,syssrc,src,sharesrc,gnusrc,debug interact http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202011092220Z/amd64/

login: root

gdb sync

l main

>Fix:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55802 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Sat, 14 Nov 2020 16:24:03 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Sat Nov 14 21:24:03 UTC 2020

 Modified Files:
 	src/external/gpl3/gcc/dist/gcc: file-prefix-map.c

 Log Message:
 PR/55802: Andreas Gustafsson: Unbreak reproducible builds.

 For reproducible builds to work we need to have a consistent command
 line (because the command line gets recorded in dwarf). So we can't
 do:

     -ffile-prefix-map=/joe/random/src=/usr/src

 because then /joe/random/src gets recorded. We do instead:

     -ffile-prefix-map=\$NETBSDSRCDIR=/usr/src

 The patch restores the environment variable parsing that got lost
 in the last 2 gcc upgrades.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Andreas Gustafsson <gson@gson.org>
To: "Christos Zoulas" <christos@netbsd.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: PR/55802 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Mon, 16 Nov 2020 11:04:40 +0200

 Christos Zoulas committed:
 >  cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/dist/gcc/file-prefix-map.c

 Thanks, I can confirm that after this fix, gdb finds the sources.
 I have not checked whether the entire release is now reproducible.

 >  For reproducible builds to work we need to have a consistent command
 >  line (because the command line gets recorded in dwarf). So we can't
 >  do:
 >  
 >      -ffile-prefix-map=/joe/random/src=/usr/src
 >  
 >  because then /joe/random/src gets recorded. We do instead:
 >  
 >      -ffile-prefix-map=\$NETBSDSRCDIR=/usr/src
 >  
 >  The patch restores the environment variable parsing that got lost
 >  in the last 2 gcc upgrades.

 Is this really still necessary, though - hasn't gcc been fixed to not
 store the original lefthand side of the file mapping options by now?
 -- 
 Andreas Gustafsson, gson@gson.org

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.