From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWuX-0001AH-W4 for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWuU-0007PR-QQ for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:44637) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcWuU-0007PL-Mv for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fcWuU-0005Gc-Gh for guix-patches@gnu.org; Mon, 09 Jul 2018 10:13:02 -0400 Subject: [bug#32102] [PATCH] utils: Fix wrap-program filename generation. Resent-Message-ID: References: <20180709013103.26091-1-arunisaac@systemreboot.net> <87k1q4j1zk.fsf@lassieur.org> From: =?UTF-8?Q?Cl=C3=A9ment?= Lassieur In-reply-to: Date: Mon, 09 Jul 2018 16:12:31 +0200 Message-ID: <87r2kc8pm8.fsf@lassieur.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Arun Isaac Cc: 32102@debbugs.gnu.org Arun Isaac writes: >>> * guix/build/utils.scm (wrap-program): While generating a new filename = for the >>> wrapped program, trim dots from the left of the basename. This prevents >>> already wrapped files being wrapped again with two or more dots prepend= ed to >>> them. >> >> Why is it a problem that two or more dots are prepended to them? > > (define (wrap-program prog #:rest vars) > (define wrapped-file > (string-append > (dirname prog) "/." (basename prog) "-real")) > > (define already-wrapped? > (file-exists? wrapped-file)) > > ...) > > If wrap-program finds that PROG has previously been wrapped, it extends > the wrapper; it does not create a wrapper around the previously existing > wrapper (a "double wrapper"). wrap-program detects that PROG has > previously been wrapped by comparing the expected wrapped filename (see > code snippet above). Without the string-trim I added, this > already-wrapped? detection fails and a double wrapper ends up being > created. If '.gajim-real' exists and (WRAP-PROGRAM '/path/to/gajim' ...) is called, PROG is '/path/to/gajim', WRAPPED-FILE is '/path/to/.gajim-real' and ALREADY-WRAPPED? is #t, so I don't think there is a bug with WRAP-PROGRAM. The ..gajim-real-real file comes from the WRAP procedure in python-build-system.scm: that WRAP procedure wraps every file it finds. It'll wrap '.gajim-real' and 'gajim'. Wrapping 'gajim' will work well, it will be modified because it's already a wrapper, i.e. '.gajim-real' exists. But wrapping '.gajim-real' will create '..gajim-real-real' because '.gajim-real' is not a wrapper. And I think it's normal too. So the question is: should WRAP (from python-build-system.scm) wrap files that already have a wrapper? I think it shouldn't. Cl=C3=A9ment