* [PR PATCH] heirloom-sh: allow Heirloom-specific profiles (patch)
@ 2020-11-05 2:06 roarde
2020-11-05 2:46 ` ahesford
2020-11-05 2:46 ` [PR PATCH] [Closed]: " ahesford
0 siblings, 2 replies; 3+ messages in thread
From: roarde @ 2020-11-05 2:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1236 bytes --]
There is a new pull request by roarde against master on the void-packages repository
https://github.com/roarde/void-packages heirloom-profile
https://github.com/void-linux/void-packages/pull/26143
heirloom-sh: allow Heirloom-specific profiles (patch)
Allows administrators to bypass a presumably modern `/etc/profile`, and whatever has been dropped into `/etc/profile.d/`, by providing an `/etc/heirloom/profile`. Users can do the same with `~/.heirloom_profile` for `~/.profile`. The present, traditional behavior is restored by removing those files.
Originally prepared with a manual page edit, but the body of that text was last touched by Caldera before 1996. The echo lines and commentary in the profiles is enough documentation, and very easily removed by admins/users. I'll happily amend to documenting in the manpage, if that's wanted. In that case, probably will remove the *file* `/etc/skel/.heirloom_profile`, and shorten the commentary in the other to just 'See "Invocation" in heirloom-sh(1)'; also, just have the one patch and no `series` file that way.
So far, only packaged and tested for i686.
A patch file from https://github.com/void-linux/void-packages/pull/26143.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-heirloom-profile-26143.patch --]
[-- Type: text/x-diff, Size: 8630 bytes --]
From b29a505085cdee262f5f8807bac5a6f7b66fd53d Mon Sep 17 00:00:00 2001
From: Roarde <roarde@example.net>
Date: Thu, 5 Nov 2020 00:58:31 +0000
Subject: [PATCH] heirloom-sh: allow Heirloom-specific profiles (patch)
---
srcpkgs/heirloom-sh/files/system-profile | 6 ++
srcpkgs/heirloom-sh/files/user-profile | 6 ++
...rloom-specific-profiles-manpage-incl.patch | 97 +++++++++++++++++++
.../allow-heirloom-specific-profiles.patch | 59 +++++++++++
srcpkgs/heirloom-sh/patches/series | 1 +
srcpkgs/heirloom-sh/template | 9 +-
6 files changed, 175 insertions(+), 3 deletions(-)
create mode 100644 srcpkgs/heirloom-sh/files/system-profile
create mode 100644 srcpkgs/heirloom-sh/files/user-profile
create mode 100644 srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch
create mode 100644 srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch
create mode 100644 srcpkgs/heirloom-sh/patches/series
diff --git a/srcpkgs/heirloom-sh/files/system-profile b/srcpkgs/heirloom-sh/files/system-profile
new file mode 100644
index 00000000000..1437ad47af6
--- /dev/null
+++ b/srcpkgs/heirloom-sh/files/system-profile
@@ -0,0 +1,6 @@
+# /etc/heirloom/profile
+
+# If this file is present, it is read in place of /etc/profile. A
+# ~/.heirloom_profile will take the place of ~/.profile. Otherwise,
+# initialization is as stated under "Invocation" in heirloom_sh(1).
+echo Sourcing /etc/heirloom/profile.
diff --git a/srcpkgs/heirloom-sh/files/user-profile b/srcpkgs/heirloom-sh/files/user-profile
new file mode 100644
index 00000000000..8858cfbd1db
--- /dev/null
+++ b/srcpkgs/heirloom-sh/files/user-profile
@@ -0,0 +1,6 @@
+# $HOME/.heirloom_profile
+
+# If this file is present, it is read in place of ~/.profile. Also, an
+# /etc/heirloom/profile can take the place of /etc/profile. Otherwise,
+# initialization is as stated under "Invocation" in heirloom_sh(1).
+echo Sourcing ${HOME}/heirloom_profile.
diff --git a/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch
new file mode 100644
index 00000000000..9b322cb0b74
--- /dev/null
+++ b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles-manpage-incl.patch
@@ -0,0 +1,97 @@
+From: Roarde <roarde@example.net>
+Date: Mon 02 Nov 2020 08:41:40 AM UTC
+Subject: [heirloom-sh] Allow Heirloom-specific profiles
+
+If /etc/heirloom/profile exists, read it instead of /etc/profile; same
+for an ~/.heirloom_profile and ~/.profile.
+
+_____
+
+diff -u ./defs.h ../new/defs.h
+--- ./defs.h 2005-07-03 19:25:46.000000000 +0000
++++ ../new/defs.h 2020-10-30 19:13:00.980629847 +0000
+@@ -461,7 +461,9 @@
+ /* prompting */
+ extern const char stdprompt[];
+ extern const char supprompt[];
++extern const char hlprofile[];
+ extern const char profile[];
++extern const char syscfgdirs[];
+ extern const char sysprofile[];
+
+ /* built in names */
+Common subdirectories: ./fakewchar and ../new/fakewchar
+diff -u ./main.c ../new/main.c
+--- ./main.c 2005-07-03 19:25:46.000000000 +0000
++++ ../new/main.c 2020-10-30 19:55:43.016599989 +0000
+@@ -268,14 +268,14 @@
+
+ #ifndef RES
+
+- if ((input = pathopen(nullstr, sysprofile)) >= 0)
++ if ((input = pathopen(syscfgdirs, sysprofile)) >= 0)
+ exfile(rflag); /* file exists */
+
+ #endif
+ /* user profile */
+
+- if ((input = pathopen(homenod.namval, profile)) >= 0)
+- {
++ if ((input = pathopen(homenod.namval, hlprofile)) >= 0 ||
++ (input = pathopen(homenod.namval, profile)) >= 0) {
+ exfile(rflag);
+ flags &= ~ttyflg;
+ }
+diff -u ./msg.c ../new/msg.c
+--- ./msg.c 2005-07-03 19:25:46.000000000 +0000
++++ ../new/msg.c 2020-10-30 19:16:40.050891092 +0000
+@@ -151,8 +151,10 @@
+ const char readmsg[] = "> ";
+ const char stdprompt[] = "$ ";
+ const char supprompt[] = "# ";
++const char hlprofile[] = ".heirloom_profile";
+ const char profile[] = ".profile";
+-const char sysprofile[] = "/etc/profile";
++const char syscfgdirs[] = "/etc/heirloom:/etc";
++const char sysprofile[] = "profile";
+
+ /*
+ * tables
+diff -u ./sh.1 ../new/sh.1
+--- ./sh.1 2005-07-03 16:43:18.000000000 +0000
++++ ../new/sh.1 2020-11-02 06:08:36.273336949 +0000
+@@ -1442,12 +1442,17 @@
+ .SS "Invocation"
+ If the first character of argument zero is
+ .BR \- ,
+-commands are read from
++commands are read from the first of
++.B /etc/heirloom/profile
++or
+ .B /etc/profile
+-and
+-.BR \s-1$HOME\s0/.\|profile ,
+-if the respective file exists.
++which exists, if either, and then likewise from
++.B \s-1$HOME\s0/.\|heirloom_profile
++or
++.BR \s-1$HOME\s0/.\|profile .
+ Commands are then read as described below.
++.PD
++.PP
+ The following flags are interpreted by the shell
+ when it is invoked.
+ .PD 0
+@@ -1595,8 +1600,12 @@
+ .I wait
+ command (see above) recognizes job ids in its arguments.
+ .SH FILES
++/etc/heirloom/profile
++.br
+ /etc/profile
+ .br
++.RB $HOME/ . \^heirloom_profile
++.br
+ .RB $HOME/ . \^profile
+ .br
+ /tmp/sh*
diff --git a/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch
new file mode 100644
index 00000000000..e95488c91c3
--- /dev/null
+++ b/srcpkgs/heirloom-sh/patches/allow-heirloom-specific-profiles.patch
@@ -0,0 +1,59 @@
+From: Roarde <roarde@example.net>
+Date: Wed 04 Nov 2020 07:08:58 AM UTC
+Subject: [heirloom-sh] Allow Heirloom-specific profiles
+
+If /etc/heirloom/profile exists, read it instead of /etc/profile; same
+for an ~/.heirloom_profile and ~/.profile.
+
+_____
+
+diff -u ./defs.h ../new/defs.h
+--- ./defs.h 2005-07-03 19:25:46.000000000 +0000
++++ ../new/defs.h 2020-10-30 19:13:00.980629847 +0000
+@@ -461,7 +461,9 @@
+ /* prompting */
+ extern const char stdprompt[];
+ extern const char supprompt[];
++extern const char hlprofile[];
+ extern const char profile[];
++extern const char syscfgdirs[];
+ extern const char sysprofile[];
+
+ /* built in names */
+Common subdirectories: ./fakewchar and ../new/fakewchar
+diff -u ./main.c ../new/main.c
+--- ./main.c 2005-07-03 19:25:46.000000000 +0000
++++ ../new/main.c 2020-10-30 19:55:43.016599989 +0000
+@@ -268,14 +268,14 @@
+
+ #ifndef RES
+
+- if ((input = pathopen(nullstr, sysprofile)) >= 0)
++ if ((input = pathopen(syscfgdirs, sysprofile)) >= 0)
+ exfile(rflag); /* file exists */
+
+ #endif
+ /* user profile */
+
+- if ((input = pathopen(homenod.namval, profile)) >= 0)
+- {
++ if ((input = pathopen(homenod.namval, hlprofile)) >= 0 ||
++ (input = pathopen(homenod.namval, profile)) >= 0) {
+ exfile(rflag);
+ flags &= ~ttyflg;
+ }
+diff -u ./msg.c ../new/msg.c
+--- ./msg.c 2005-07-03 19:25:46.000000000 +0000
++++ ../new/msg.c 2020-10-30 19:16:40.050891092 +0000
+@@ -151,8 +151,10 @@
+ const char readmsg[] = "> ";
+ const char stdprompt[] = "$ ";
+ const char supprompt[] = "# ";
++const char hlprofile[] = ".heirloom_profile";
+ const char profile[] = ".profile";
+-const char sysprofile[] = "/etc/profile";
++const char syscfgdirs[] = "/etc/heirloom:/etc";
++const char sysprofile[] = "profile";
+
+ /*
+ * tables
diff --git a/srcpkgs/heirloom-sh/patches/series b/srcpkgs/heirloom-sh/patches/series
new file mode 100644
index 00000000000..f6dd605b872
--- /dev/null
+++ b/srcpkgs/heirloom-sh/patches/series
@@ -0,0 +1 @@
+allow-heirloom-specific-profiles.patch
diff --git a/srcpkgs/heirloom-sh/template b/srcpkgs/heirloom-sh/template
index 3f62628668d..97769216642 100644
--- a/srcpkgs/heirloom-sh/template
+++ b/srcpkgs/heirloom-sh/template
@@ -1,14 +1,15 @@
# Template file for 'heirloom-sh'
pkgname=heirloom-sh
version=050706
-revision=4
+revision=5
short_desc="A portable variant of the traditional Unix shell"
maintainer="allan <mail@may.mooo.com>"
-license="Caldera"
+license="CDDL-1.0, Caldera"
homepage="http://heirloom.sourceforge.net/sh.html"
distfiles="${SOURCEFORGE_SITE}/heirloom/${pkgname}/${version}/${pkgname}-${version}.tar.bz2"
checksum=25fb8409e1eb75bb5da21ca32baf2d5eebcb8b84a1288d66e65763a125809e1d
-register_shell="/bin/heirloom-sh"
+conf_files="/etc/heirloom/profile /etc/skel/.heirloom_profile"
+register_shell="/usr/bin/heirloom-sh /bin/heirloom-sh"
do_build() {
make CC=$CC CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ${makejobs}
@@ -18,4 +19,6 @@ do_install() {
vman sh.1.out heirloom-sh.1
vlicense CALDERA.LICENSE
vlicense OPENSOLARIS.LICENSE
+ vinstall ${FILESDIR}/system-profile 0644 etc/heirloom profile
+ vinstall ${FILESDIR}/user-profile 0644 etc/skel .heirloom_profile
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: heirloom-sh: allow Heirloom-specific profiles (patch)
2020-11-05 2:06 [PR PATCH] heirloom-sh: allow Heirloom-specific profiles (patch) roarde
@ 2020-11-05 2:46 ` ahesford
2020-11-05 2:46 ` [PR PATCH] [Closed]: " ahesford
1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2020-11-05 2:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 450 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/26143#issuecomment-722102220
Comment:
WONTFIX. Void does not accept patches that change upstream behavior just for the sake of different behavior. We will patch bugs that have already been fixed but not rolled into a release, and we will patch to improve libc or architecture compatibility.
If you want this behavior, get it accepted upstream.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PR PATCH] [Closed]: heirloom-sh: allow Heirloom-specific profiles (patch)
2020-11-05 2:06 [PR PATCH] heirloom-sh: allow Heirloom-specific profiles (patch) roarde
2020-11-05 2:46 ` ahesford
@ 2020-11-05 2:46 ` ahesford
1 sibling, 0 replies; 3+ messages in thread
From: ahesford @ 2020-11-05 2:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]
There's a closed pull request on the void-packages repository
heirloom-sh: allow Heirloom-specific profiles (patch)
https://github.com/void-linux/void-packages/pull/26143
Description:
Allows administrators to bypass a presumably modern `/etc/profile`, and whatever has been dropped into `/etc/profile.d/`, by providing an `/etc/heirloom/profile`. Users can do the same with `~/.heirloom_profile` for `~/.profile`. The present, traditional behavior is restored by removing those files.
Originally prepared with a manual page edit, but the body of that text was last touched by Caldera before 1996. The echo lines and commentary in the profiles is enough documentation, and very easily removed by admins/users. I'll happily amend to documenting in the manpage, if that's wanted. In that case, probably will remove the *file* `/etc/skel/.heirloom_profile`, and shorten the commentary in the other to just 'See "Invocation" in heirloom-sh(1)'; also, just have the one patch and no `series` file that way.
So far, only packaged and tested for i686.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-05 2:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 2:06 [PR PATCH] heirloom-sh: allow Heirloom-specific profiles (patch) roarde
2020-11-05 2:46 ` ahesford
2020-11-05 2:46 ` [PR PATCH] [Closed]: " ahesford
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).