On Wed, Jan 25, 2017 at 11:11:31AM +0300, Dmitry Bogatov wrote: > > [2017-01-24 17:19] Peter Pentchev <roam@ringlet.net> > > > > Package: wnpp > > Severity: wishlist > > Owner: Peter Pentchev <roam@ringlet.net> > > > > * Package name : rname > > Version : 1.0.2 > > Upstream Author : Peter Pentchev <roam@ringlet.net> > > * URL : https://devel.ringlet.net/sysutils/rname/ > > * License : BSD-2-clause > > Programming Lang: C > > Description : invoke a program under a different name > > > > The rname utility invokes a specified program, passing a different name > > instead of the name of the program executable. This could be useful in > > a number of cases, both during software development, testing, and in > > production use. There are many programs that do different things based > > on what name they have been invoked under; the rname utility avoids > > the need to e.g. create ephemeral symlinks to run these programs in > > some conditions when they have not been completely installed. > > > > I originally wrote this tool in 2000 and I'm resurrecting it now for > > the purpose of writing unit and integration tests for just such > > a multifaceted program. > > One more argv0 implementation? I know at least two: > > $ dpkg -S argv0 > ucspi-tcp: /usr/bin/argv0 > [...] > $ dpkg -S chpst > runit: /usr/bin/chpst > [...] > > Probably, there is already a lot. OK, so this is embarrassing :) The rname webpage even refers to ucspi-tcp as the reason I wrote this back in 2000; guess I didn't notice argv0 there even then :/ Thanks for pointing this out! And as for Christian and Josh's emails, yes, I should've mentioned straight up front that I did indeed know about exec -a and I did know that I can do this with Perl and Python. However, for many command-line tools that I write (and I've written quite a lot, even though not all of them have seen the light of day), the test suite is one of these three: - a Perl t/*.t script using Test::Command - a POSIX shell t/*.t script outputting TAP - just a couple of lines in a Makefile's "test" target Of these, only Test::Command looks like it might be possible to be extended in a sensible way. Of course, the other two may go for "bash required, it's available almost everywhere anyway", but I do tend to steer clear of this point of view (long-time FreeBSD user and, once upon a time, committer; also more hours than I like to remember invested in former jobs herding Solaris and HP/UX boxes...). However, since there is already an argv0 in uscpi-tcp (argh!), I'm closing this. Thanks for all the responses! G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org pp@storpool.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
Attachment:
signature.asc
Description: PGP signature