-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NonConsistentTarUsage: check tar without -f
The ``tar`` command defaults to reading from stdin, unless this default is changed at compile time or the ``TAPE`` environment variable is set. To ensure consistent behavior, the ``-f`` or ``--file`` option should always be given to ensure the input device is chosen explicitly. Resolves: #704 Signed-off-by: Arthur Zamarin <[email protected]>
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
testdata/data/repos/standalone/NonPosixCheck/NonConsistentTarUsage/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{"__class__": "NonConsistentTarUsage", "category": "NonPosixCheck", "package": "NonConsistentTarUsage", "version": "0", "line": "tar -zx \"${A}\"", "lineno": 7} | ||
{"__class__": "NonConsistentTarUsage", "category": "NonPosixCheck", "package": "NonConsistentTarUsage", "version": "0", "line": "tar c \\\n\t\t--owner=0 \\\n\t\t--group=0 \\\n\t\t--numeric-owner \\\n\t\t-C \"${S}\" .", "lineno": 8} |
13 changes: 13 additions & 0 deletions
13
testdata/data/repos/standalone/NonPosixCheck/NonConsistentTarUsage/fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- standalone/NonPosixCheck/NonConsistentTarUsage/NonConsistentTarUsage-0.ebuild | ||
+++ fixed/NonPosixCheck/NonConsistentTarUsage/NonConsistentTarUsage-0.ebuild | ||
@@ -4,8 +4,8 @@ LICENSE="BSD" | ||
SLOT="0" | ||
|
||
src_prepare() { | ||
- tar -zx "${A}" | ||
- tar c \ | ||
+ tar -zx -f - "${A}" | ||
+ tar cf - \ | ||
--owner=0 \ | ||
--group=0 \ | ||
--numeric-owner \ |
15 changes: 15 additions & 0 deletions
15
testdata/repos/standalone/NonPosixCheck/NonConsistentTarUsage/NonConsistentTarUsage-0.ebuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
DESCRIPTION="Ebuild with non posix tar usage" | ||
HOMEPAGE="https://github.com/pkgcore/pkgcheck" | ||
LICENSE="BSD" | ||
SLOT="0" | ||
|
||
src_prepare() { | ||
tar -zx "${A}" | ||
tar c \ | ||
--owner=0 \ | ||
--group=0 \ | ||
--numeric-owner \ | ||
-C "${S}" . | something | ||
tar -c -f - -C "${S}" . | something | ||
tar -c --file - -C "${S}" . | something | ||
} |