locking/atomics: Use sed(1) instead of non-standard head(1) option
PATCH 1/1 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.
--- scripts/atomic/check-atomics.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/atomic/check-atomics.sh +1 -1
@@ -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
Signature · 1 line
2.20.1
Quoted 11 lines · Michael Forney
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 <[email protected]>--- scripts/atomic/check-atomics.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Will
Peter Zijlstra
maintainerQuoted 8 lines · Will Deacon
Quoted 7 lines · Michael Forney
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.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Michael Forney <[email protected]>--- scripts/atomic/check-atomics.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Acked-by Will Deacon <[email protected]>
Thanks!
tip-bot for Michael Forney
merge botlocking/atomics: Use sed(1) instead of non-standard head(1) option
Commit-ID: ebf8d82bbb32720878a3867b28e655950ccee992 Gitweb: https://git.kernel.org/tip/ebf8d82bbb32720878a3867b28e655950ccee992 Author: Michael Forney <[email protected]> AuthorDate: Mon, 17 Jun 2019 22:33:06 -0700 Committer: Ingo Molnar <[email protected]> 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.
--- scripts/atomic/check-atomics.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/atomic/check-atomics.sh +1 -1
@@ -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