Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 558360 - warning for non posix compatible use of head/tail and maybe others
Summary: warning for non posix compatible use of head/tail and maybe others
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: PkgCore (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PkgCore project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-21 19:53 UTC by Justin Lecher (RETIRED)
Modified: 2022-11-08 18:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2015-08-21 19:53:54 UTC
I would like to kill this quiz question and have a repoman check instead:

8. Why are 'head -5' and 'tail -5' bad? What should be used instead?

Please implement such. Probably there are other non posix compliant things we can check too.
Comment 1 Zac Medico gentoo-dev 2015-08-21 21:04:43 UTC
It would be nice to have a section on "shell code portability" in the devmanual or developer handbook if there isn't already.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-20 02:00:33 UTC
I have no idea if we want to implement this nowadays. Note that it's no longer in quiz.

Related: we have fixheadtails.eclass.
Comment 3 Arthur Zamarin archtester Gentoo Infrastructure gentoo-dev Security 2022-11-03 17:45:45 UTC
Opened PR for that new check request for pkgcheck
Comment 4 Larry the Git Cow gentoo-dev 2022-11-08 18:59:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=bad313667aa111639f9c5801d6f10420968ac2b9

commit bad313667aa111639f9c5801d6f10420968ac2b9
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2022-11-03 17:43:47 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2022-11-08 18:59:00 +0000

    NonPosixHeadTailUsage: new check
    
    New warning for non-POSIX compliant head or tail without -n.
    
    Closes: https://bugs.gentoo.org/558360
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 src/pkgcheck/checks/codingstyle.py                 | 46 ++++++++++++++++++++++
 .../NonPosixHeadTailUsage/expected.json            |  5 +++
 .../NonPosixCheck/NonPosixHeadTailUsage/fix.patch  | 26 ++++++++++++
 .../NonPosixHeadTailUsage-0.ebuild                 | 10 +++++
 .../NonPosixHeadTailUsage-1.ebuild                 | 11 ++++++
 5 files changed, 98 insertions(+)