git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Michael J Gruber <git@drmicha.warpmail.net>,
	git@vger.kernel.org, Joachim Schmitz <jojo@schmitz-digital.de>
Subject: Re: [RFC/PATCH 3/4v2] test-lib: provide lazy TIME_COMMAND prereq
Date: Tue, 16 Oct 2012 12:34:08 -0700	[thread overview]
Message-ID: <7v8vb6rz2n.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <507DB39C.3080005@kdbg.org> (Johannes Sixt's message of "Tue, 16 Oct 2012 21:21:00 +0200")

Johannes Sixt <j6t@kdbg.org> writes:

> Am 16.10.2012 17:07, schrieb Michael J Gruber:
>> Some test want to use the time command (not the shell builtin) and test
>> for its availability at /usr/bin/time.
>> 
>> Provide a lazy prereq TIME_COMMAND which tests for $TEST_COMMAND_PATH,
>> which can be set from config.mak. It defaults to /usr/bin/time.
>
> This avoids the builtin:
>
> 	command time $that_command
>
> It works for bash, ksh, zsh, and dash (where the latter doesn't have it
> as builtin).

"command time" works but I think that is because it is not a
built-in ;-)

Here is what I read in bash(1):

       command [-pVv] command [arg ...]  Run command with args
              suppressing the normal shell function lookup. Only
              builtin commands or commands found in the PATH are
              executed.

Taken together with this from "COMMAND EXECUTION":

       If the command name contains no slashes, the shell attempts
       to locate it.  If there exists a shell function by that name,
       that function is invoked as described above in FUNCTIONS.  If
       the name does not match a function, the shell searches for it
       in the list of shell builtins.  If a match is found, that
       builtin is invoked.

       If the name is neither a shell function nor a builtin, and
       contains no slashes, bash searches each element of the PATH
       for a directory containing an executable file by that name.

I suspect "command printf 'a b c\n'" would not use $HOME/bin/printf
even when I have $HOME/bin early in my $PATH (nor /usr/bin/printf
for that matter).

  reply	other threads:[~2012-10-16 19:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 10:56 t3302-notes-index-expensive.sh and t3419-rebase-patch-id.sh need time in /usr/bin Joachim Schmitz
2012-10-16 11:39 ` [PATCH 0/4] Allow different time commands Michael J Gruber
2012-10-16 11:39   ` [PATCH 1/4] t3419-rebase-patch-id: heed USR_BIN_TIME prereq Michael J Gruber
2012-10-16 16:32     ` Junio C Hamano
2012-10-16 11:39   ` [PATCH 2/4] test-lib: allow variable export from lazy prereq tests Michael J Gruber
2012-10-16 16:16     ` Junio C Hamano
2012-10-16 11:39   ` [RFC/PATCH 3/4] test-lib: provide lazy TIME_COMMAND prereq Michael J Gruber
2012-10-16 14:13     ` Joachim Schmitz
2012-10-16 15:06       ` Michael J Gruber
2012-10-16 15:11         ` Joachim Schmitz
2012-10-16 15:07       ` [RFC/PATCH 3/4v2] " Michael J Gruber
2012-10-16 16:28         ` Andreas Schwab
2012-10-16 18:28           ` Stefano Lattarini
2012-10-16 19:21         ` Johannes Sixt
2012-10-16 19:34           ` Junio C Hamano [this message]
2012-10-16 16:41     ` [RFC/PATCH 3/4] " Junio C Hamano
2012-10-16 11:39   ` [PATCH 4/4] t3302,t3419: use the " Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8vb6rz2n.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=jojo@schmitz-digital.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).