From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: Re: avoid wrapper scripts when possible Date: Sat, 4 Nov 2017 16:42:43 -0500 Message-ID: <20171104164243.12c81e3d@centurylink.net> References: <87mv44gyfv.fsf@elephly.net> <20171103185416.0ffc4065@cbaines.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/pC4Px/w0e4zhAV++mqW8pCK"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBAtZ-00051C-83 for guix-devel@gnu.org; Sat, 04 Nov 2017 22:42:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBAtU-0003Z1-D1 for guix-devel@gnu.org; Sat, 04 Nov 2017 22:42:45 -0400 Received: from mail.centurylink.net ([205.219.233.9]:29777 helo=smtp.centurylink.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eBAtU-0003Y1-5r for guix-devel@gnu.org; Sat, 04 Nov 2017 22:42:40 -0400 In-Reply-To: <20171103185416.0ffc4065@cbaines.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Christopher Baines Cc: guix-devel@gnu.org --Sig_/pC4Px/w0e4zhAV++mqW8pCK Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 3 Nov 2017 18:54:16 +0000 Christopher Baines wrote: > However, I think that the file wrapping approach has advantages for > visibility. Maybe it could be tweaked to keep ensure the wrapper script > has the same name as the script its wrapping, e.g. when wrapping foo, > replace foo with a bash script, and move the real script > to .wrapped-bin/foo. We already try to do just that, by using the -a flag when exec'ing the real program from the wrapper. But... > the environment activation feature of our =E2=80=9Cconda=E2=80=9D package= currently > fails. This is because the =E2=80=9Cdeactivate=E2=80=9D shell script is = wrapped in > another shell script. This leads to the actual shell script to be > called =E2=80=9C.deactivate-real=E2=80=9D. The script compares the value= of =E2=80=9C$0=E2=80=9D with > the expected name =E2=80=9Cdeactivate=E2=80=9D. This fails so conda misb= ehaves. ... it doesn't behave correctly when the "real" program is shebang-interpreted. It works fine for compiled programs. =20 E.g. our "emacs-25.3" is a wrapper that sets XDG and GTK env vars, but top/htop/ps show the proper "emacs-25.3". OTOH we have the "deactivate" example from Ricardo, which is a shell script, and e.g. youtube-dl, whose --help output includes "Usage: .youtube-dl-real ...". So the interpreters are not passing on the intended zeroth argument. IMHO it'd be nice to find some way to fix that. A while ago I had looked into patching Perl libraries/programs. But like Hartmut mentioned for python, I noticed after some research that patching perl paths would be nontrivial, and would require a perl parser to determine where and how to patch the library paths correctly. 2c, `~Eric --Sig_/pC4Px/w0e4zhAV++mqW8pCK Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEoMXjUi7471xkzbfw/XPKxxnTJWYFAln+NFMACgkQ/XPKxxnT JWa4Ng//Vd48GUchR3m+Xw/rfj4O+byA92J5Dkt01U4IONHrxfB+iKGTlsjvVvMy YlJ1xUswkjLVxOkuIGGtg2EoAyGjEeygNUTmjTq1AtHSHGYm/vtEMaKhVyvjU0qd 4j54349jB/0tyyEcg1lZN7DgKF9GA69kEUwZPYo4QCsDfPazEcl2HhyvudSRXSFf ZedWSZhzpUxZkQz5C+fmfUydAmitm2RTFUNiNIm0UQPp/uI17EqzWc2bHASCKNjh LZovgnOyWF00DwLosZ9ArAuyHti665AyY08PqwXQD6tHBllkl28hhEs8GjnvIEc+ d7GcXA8dwY3ms56ZJSzzqJNhW5lKAxSLJnEbkYnkzVluSAFQ/oJYxHynPqkA1EHf PHef2lPSJoP1HdEctaKDHVzJ3L8XBdaC3pM6XNK9XKR7307Yex3Ea+/ememdirdc QyR8eqbJ+2Ye4uIiaQCcVkJIFM41ndjYJqyshdexpcaELsDcW1YJiEGHkka20WZv QPzoEzQJhq/WzL5I6KxwWYVdp4HPG5xMix49dwjaPBiWUrUv4DS+do2kt9zahBtm mCe5Jpw8rvMIgvloP37nGmsC72MkUEEODEXZT4cN/2dIE2t1yFN5dVN94MSKkYS5 Jb9mBBZAQ9DZp1Y0+xvep6mInmO+CV+TsmKh+YTe0rDTET3t37o= =Eglj -----END PGP SIGNATURE----- --Sig_/pC4Px/w0e4zhAV++mqW8pCK--