Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 718920 - app-admin/eselect-1.4.16 rc show mishandles stacked runlevel
Summary: app-admin/eselect-1.4.16 rc show mishandles stacked runlevel
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: eselect (show other bugs)
Hardware: All Linux
: Normal trivial (vote)
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2020-04-22 17:49 UTC by Wojciech Pyczak
Modified: 2020-12-16 12:10 UTC (History)
0 users

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 Wojciech Pyczak 2020-04-22 17:49:13 UTC
Executing command "eselect rc show primary" results in (hopefully) harmless error message:
/usr/share/eselect/modules/rc.eselect: line 39: read: read error: 0: Is a directory

Quick check revealed it's caused by calling function is_script on link to parent runlevel:
lrwxrwxrwx 1 root root 10 Apr 22 13:14 /etc/runlevels/primary/default -> ../default

Reproducible: Always

Steps to Reproduce:
1. create stacked runlevel, i.e. mkdir /etc/runlevels/stacked && rc-update -s add default stacked
2. run eselect rc show stacked
Comment 1 Ulrich Müller gentoo-dev 2020-04-22 18:29:37 UTC
Hm, I guess it should have an additional test for the script being a regular file:

--- a/modules/rc.eselect
+++ b/modules/rc.eselect
@@ -35,6 +35,7 @@ is_script() {
 	[[ -n ${file} \
 			 && ${file%%.sh} = "${file}" \
 			 && ${file%%\~} = "${file}" \
+			 && -f ${file} \
 			 && -x ${file} ]] \
 		&& read line <"${file}" \
 		&& [[ ${line} =~ ^#!.*(runscript|openrc-run) ]]
Comment 2 Wojciech Pyczak 2020-04-23 11:02:37 UTC
That works just fine.
Comment 3 Larry the Git Cow gentoo-dev 2020-04-23 12:42:50 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/eselect.git/commit/?id=e757ab1145cc4c6ce7b2c2005220ae59792e218e

commit e757ab1145cc4c6ce7b2c2005220ae59792e218e
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2020-04-23 12:40:28 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2020-04-23 12:40:28 +0000

    rc.eselect: Test for regular file.
    
    * modules/rc.eselect (is_script): Test whether the script is a
    regular file, bug 718920.
    
    Bug: https://bugs.gentoo.org/718920
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 ChangeLog          | 5 +++++
 modules/rc.eselect | 1 +
 2 files changed, 6 insertions(+)
Comment 4 Ulrich Müller gentoo-dev 2020-04-23 12:47:18 UTC
Thanks for testing.

This doesn't affect behaviour (other than output of the error message), so it will have to wait for the next release.
Comment 5 Larry the Git Cow gentoo-dev 2020-12-16 12:09:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1021d268b8b73b06b4409115af18655ea42dd7ff

commit 1021d268b8b73b06b4409115af18655ea42dd7ff
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2020-12-16 12:03:58 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2020-12-16 12:09:12 +0000

    app-admin/eselect: Version bump to 1.4.17.
    
    Closes: https://bugs.gentoo.org/718920
    Closes: https://bugs.gentoo.org/760081
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 app-admin/eselect/Manifest              |  1 +
 app-admin/eselect/eselect-1.4.17.ebuild | 58 +++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
Comment 6 Ulrich Müller gentoo-dev 2020-12-16 12:10:06 UTC
Fixed in eselect-1.4.17.
Thank you for reporting.