# [PATCH] git-commit.sh: Remove option -n from tail

10 messages from 2007-10-16 to 2007-10-16. Participants: Jari Aalto, David Brown, YOSHIFUJI Hideaki / 吉藤英明, Johannes Schindelin, Florian Weimer, Theodore Tso.
Thread: https://gitlist.dev/t/10319

## Jari Aalto, 2007-10-16 16:57

Subject: [PATCH] tail -n not supported in all OSs
Message-ID: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>
URL: https://gitlist.dev/e/1192553837-18302-1-git-send-email-jari.aalto%40cante.net

```

SunOS/Solaris tail(1) does not support option '-n'. The
following patches change occurrances of:

   tail -n <N>

to

   tail <N>

---------------------------------------------------------------------
REFERENCES:

User Commands                                             TAIL(1)
                        
NAME
     tail - output the last part of files

SYNOPSIS
     tail [OPTION]... [FILE]...

- - -

$ uname -a
SunOS host 5.9 Generic_118558-35 sun4u sparc SUNW,Serverblade1

$ echo | tail -n 1

usage: tail [+/-[n][lbc][f]] [file]
       tail [+/-[n][l][r|f]] [file]                     

```

## Jari Aalto, 2007-10-16 16:57

Subject: [PATCH] git-am.sh: Remove option -n from tail
Message-ID: <1192553837-18302-2-git-send-email-jari.aalto@cante.net>
URL: https://gitlist.dev/e/1192553837-18302-2-git-send-email-jari.aalto%40cante.net
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 git-am.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/git-am.sh b/git-am.sh
index b02ae6a..09a991c 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -2,6 +2,8 @@
 #
 # Copyright (c) 2005, 2006 Junio C Hamano
 
+TAIL="tail"
+
 USAGE='[--signoff] [--dotest=<dir>] [--keep] [--utf8 | --no-utf8]
   [--3way] [--interactive] [--binary]
   [--whitespace=<option>] [-C<n>] [-p<n>]
@@ -321,7 +323,7 @@ do
 		LAST_SIGNED_OFF_BY=`
 		    sed -ne '/^Signed-off-by: /p' \
 		    "$dotest/msg-clean" |
-		    tail -n 1
+		    $TAIL 1
 		`
 		ADD_SIGNOFF=`
 		    test "$LAST_SIGNED_OFF_BY" = "$SIGNOFF" || {
-- 
1.5.3.2.81.g17ed

```

## Jari Aalto, 2007-10-16 16:57

Subject: [PATCH] git-commit.sh: Remove option -n from tail
Message-ID: <1192553837-18302-3-git-send-email-jari.aalto@cante.net>
URL: https://gitlist.dev/e/1192553837-18302-3-git-send-email-jari.aalto%40cante.net
In-Reply-To: <1192553837-18302-2-git-send-email-jari.aalto@cante.net>

```
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 git-commit.sh |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index fcb8443..637cf48 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -3,6 +3,8 @@
 # Copyright (c) 2005 Linus Torvalds
 # Copyright (c) 2006 Junio C Hamano
 
+TAIL="tail"
+
 USAGE='[-a | --interactive] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [--template <file>] [[-i | -o] <path>...]'
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
@@ -442,10 +444,10 @@ t)
 		s/^/Signed-off-by: /
 		')
 	blank_before_signoff=
-	tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
+	$TAIL 1 "$GIT_DIR"/COMMIT_EDITMSG |
 	grep 'Signed-off-by:' >/dev/null || blank_before_signoff='
 '
-	tail -n 1 "$GIT_DIR"/COMMIT_EDITMSG |
+	$TAIL 1 "$GIT_DIR"/COMMIT_EDITMSG |
 	grep "$sign"$ >/dev/null ||
 	printf '%s%s\n' "$blank_before_signoff" "$sign" \
 		>>"$GIT_DIR"/COMMIT_EDITMSG
-- 
1.5.3.2.81.g17ed

```

## Jari Aalto, 2007-10-16 16:57

Subject: [PATCH] git-rebase--interactive.sh: Remove option -n from tail
Message-ID: <1192553837-18302-4-git-send-email-jari.aalto@cante.net>
URL: https://gitlist.dev/e/1192553837-18302-4-git-send-email-jari.aalto%40cante.net
In-Reply-To: <1192553837-18302-3-git-send-email-jari.aalto@cante.net>

```
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 git-rebase--interactive.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 050140d..58e164c 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -10,6 +10,8 @@
 # The original idea comes from Eric W. Biederman, in
 # http://article.gmane.org/gmane.comp.version-control.git/22407
 
+TAIL="tail"
+
 USAGE='(--continue | --abort | --skip | [--preserve-merges] [--verbose]
 	[--onto <branch>] <upstream> [<branch>])'
 
@@ -204,7 +206,7 @@ nth_string () {
 make_squash_message () {
 	if test -f "$SQUASH_MSG"; then
 		COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
-			< "$SQUASH_MSG" | tail -n 1)+1))
+			< "$SQUASH_MSG" | $TAIL 1)+1))
 		echo "# This is a combination of $COUNT commits."
 		sed -n "2,\$p" < "$SQUASH_MSG"
 	else
-- 
1.5.3.2.81.g17ed

```

## David Brown, 2007-10-16 17:12

Subject: Re: [PATCH] tail -n not supported in all OSs
Message-ID: <20071016171206.GA13715@old.davidb.org>
URL: https://gitlist.dev/e/20071016171206.GA13715%40old.davidb.org
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
On Tue, Oct 16, 2007 at 07:57:14PM +0300, Jari Aalto wrote:
>
>SunOS/Solaris tail(1) does not support option '-n'. The
>following patches change occurrances of:
>
>   tail -n <N>
>
>to
>
>   tail <N>

On Linux, I get

   tail: cannot open `1' for reading: No such file or directory

Did you want

   tail -<N>

David

```

## YOSHIFUJI Hideaki / 吉藤英明, 2007-10-16 17:16

Subject: Re: [PATCH] tail -n not supported in all OSs
Message-ID: <20071017.021606.45991429.yoshfuji@linux-ipv6.org>
URL: https://gitlist.dev/e/20071017.021606.45991429.yoshfuji%40linux-ipv6.org
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
In article <1192553837-18302-1-git-send-email-jari.aalto@cante.net> (at Tue, 16 Oct 2007 19:57:14 +0300), Jari Aalto <jari.aalto@cante.net> says:

> 
> SunOS/Solaris tail(1) does not support option '-n'. The
> following patches change occurrances of:
> 
>    tail -n <N>
> 
> to
> 
>    tail <N>

You should say "tail -<N>".

--yoshfuji

```

## Johannes Schindelin, 2007-10-16 17:18

Subject: Re: [PATCH] git-commit.sh: Remove option -n from tail
Message-ID: <Pine.LNX.4.64.0710161818230.25221@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0710161818230.25221%40racer.site
In-Reply-To: <1192553837-18302-3-git-send-email-jari.aalto@cante.net>

```
Hi,

On Tue, 16 Oct 2007, Jari Aalto wrote:

> Signed-off-by: Jari Aalto <jari.aalto@cante.net>

Rationale?

And also, can't this wait for the builtin-commit, which will solve this 
problem?

Ciao,
Dscho

```

## Johannes Schindelin, 2007-10-16 17:19

Subject: Re: [PATCH] tail -n not supported in all OSs
Message-ID: <Pine.LNX.4.64.0710161819180.25221@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0710161819180.25221%40racer.site
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
Hi,

On Tue, 16 Oct 2007, Jari Aalto wrote:

> 
> SunOS/Solaris tail(1) does not support option '-n'.

This belongs into the commit message.

Ciao,
Dscho

```

## Florian Weimer, 2007-10-16 20:37

Subject: Re: [PATCH] tail -n not supported in all OSs
Message-ID: <878x62dcdl.fsf@mid.deneb.enyo.de>
URL: https://gitlist.dev/e/878x62dcdl.fsf%40mid.deneb.enyo.de
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
* Jari Aalto:

> $ uname -a
> SunOS host 5.9 Generic_118558-35 sun4u sparc SUNW,Serverblade1
>
> $ echo | tail -n 1
>
> usage: tail [+/-[n][lbc][f]] [file]
>        tail [+/-[n][l][r|f]] [file]                     

What about /usr/xpg4/bin/tail?  Why aren't you using that?

```

## Theodore Tso, 2007-10-16 22:06

Subject: Re: [PATCH] tail -n not supported in all OSs
Message-ID: <20071016220624.GC1314@closure.lan>
URL: https://gitlist.dev/e/20071016220624.GC1314%40closure.lan
In-Reply-To: <1192553837-18302-1-git-send-email-jari.aalto@cante.net>

```
On Tue, Oct 16, 2007 at 07:57:14PM +0300, Jari Aalto wrote:
> 
> SunOS/Solaris tail(1) does not support option '-n'. The
> following patches change occurrances of:
> 
>    tail -n <N>
> 
> to
> 
>    tail <N>

POSIX.2 guarantees that "tail -n 2" works.  "Tail -<N>" is considered
obsolete.  Unfortunately Solaris requires you to use
/usr/xpg4/bin/tail if you want a POSIX.2 compliant header file.  The
/usr/bin/tail is designed for System V R3 compliance (i.e., from a
full two decades ago; SVR3 was released in 1987), and is due to Sun's
vow to Backwards Compatible Forever. 

See "man 5 standards" on a Solaris box to see how your PATH variable
has to be set if you want something which is compatible with modern
Unix/Linux common usage.

					- Ted

```
