linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option
@ 2019-06-18  5:33 Michael Forney
  2019-06-18 12:16 ` Will Deacon
  2019-06-25  8:46 ` [tip:locking/core] " tip-bot for Michael Forney
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Forney @ 2019-06-18  5:33 UTC (permalink / raw)
  To: Will Deacon, Peter Zijlstra; +Cc: Boqun Feng, linux-kernel

POSIX says the -n option must be a positive decimal integer. Not all
implementations of head(1) support negative numbers meaning offset from
the end of the file.

Instead, the sed expression '$d' has the same effect of removing the
last line of the file.

Signed-off-by: Michael Forney <mforney@mforney.org>
---
 scripts/atomic/check-atomics.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/atomic/check-atomics.sh b/scripts/atomic/check-atomics.sh
index cfa0c2f71c84..8378c63a1e09 100755
--- a/scripts/atomic/check-atomics.sh
+++ b/scripts/atomic/check-atomics.sh
@@ -22,7 +22,7 @@ while read header; do
 	OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
 	OLDSUM="${OLDSUM#// }"
 
-	NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"
+	NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
 	NEWSUM="${NEWSUM%% *}"
 
 	if [ "${OLDSUM}" != "${NEWSUM}" ]; then
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option
  2019-06-18  5:33 [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option Michael Forney
@ 2019-06-18 12:16 ` Will Deacon
  2019-06-18 12:52   ` Peter Zijlstra
  2019-06-25  8:46 ` [tip:locking/core] " tip-bot for Michael Forney
  1 sibling, 1 reply; 4+ messages in thread
From: Will Deacon @ 2019-06-18 12:16 UTC (permalink / raw)
  To: Michael Forney; +Cc: Peter Zijlstra, Boqun Feng, linux-kernel

On Mon, Jun 17, 2019 at 10:33:06PM -0700, Michael Forney wrote:
> POSIX says the -n option must be a positive decimal integer. Not all
> implementations of head(1) support negative numbers meaning offset from
> the end of the file.
> 
> Instead, the sed expression '$d' has the same effect of removing the
> last line of the file.
> 
> Signed-off-by: Michael Forney <mforney@mforney.org>
> ---
>  scripts/atomic/check-atomics.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option
  2019-06-18 12:16 ` Will Deacon
@ 2019-06-18 12:52   ` Peter Zijlstra
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2019-06-18 12:52 UTC (permalink / raw)
  To: Will Deacon; +Cc: Michael Forney, Boqun Feng, linux-kernel

On Tue, Jun 18, 2019 at 01:16:25PM +0100, Will Deacon wrote:
> On Mon, Jun 17, 2019 at 10:33:06PM -0700, Michael Forney wrote:
> > POSIX says the -n option must be a positive decimal integer. Not all
> > implementations of head(1) support negative numbers meaning offset from
> > the end of the file.
> > 
> > Instead, the sed expression '$d' has the same effect of removing the
> > last line of the file.
> > 
> > Signed-off-by: Michael Forney <mforney@mforney.org>
> > ---
> >  scripts/atomic/check-atomics.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Will Deacon <will.deacon@arm.com>

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:locking/core] locking/atomics: Use sed(1) instead of non-standard head(1) option
  2019-06-18  5:33 [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option Michael Forney
  2019-06-18 12:16 ` Will Deacon
@ 2019-06-25  8:46 ` tip-bot for Michael Forney
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Michael Forney @ 2019-06-25  8:46 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, peterz, linux-kernel, mforney, hpa, will.deacon,
	boqun.feng, torvalds, tglx

Commit-ID:  ebf8d82bbb32720878a3867b28e655950ccee992
Gitweb:     https://git.kernel.org/tip/ebf8d82bbb32720878a3867b28e655950ccee992
Author:     Michael Forney <mforney@mforney.org>
AuthorDate: Mon, 17 Jun 2019 22:33:06 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Jun 2019 10:17:07 +0200

locking/atomics: Use sed(1) instead of non-standard head(1) option

POSIX says the -n option must be a positive decimal integer. Not all
implementations of head(1) support negative numbers meaning offset from
the end of the file.

Instead, the sed expression '$d' has the same effect of removing the
last line of the file.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190618053306.730-1-mforney@mforney.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 scripts/atomic/check-atomics.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/atomic/check-atomics.sh b/scripts/atomic/check-atomics.sh
index cfa0c2f71c84..8378c63a1e09 100755
--- a/scripts/atomic/check-atomics.sh
+++ b/scripts/atomic/check-atomics.sh
@@ -22,7 +22,7 @@ while read header; do
 	OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
 	OLDSUM="${OLDSUM#// }"
 
-	NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"
+	NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
 	NEWSUM="${NEWSUM%% *}"
 
 	if [ "${OLDSUM}" != "${NEWSUM}" ]; then

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-25  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18  5:33 [PATCH] locking/atomics: Use sed(1) instead of non-standard head(1) option Michael Forney
2019-06-18 12:16 ` Will Deacon
2019-06-18 12:52   ` Peter Zijlstra
2019-06-25  8:46 ` [tip:locking/core] " tip-bot for Michael Forney

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 NNTP newsgroup(s).