.
OBS-URL: https://build.opensuse.org/package/show/shells/tcsh?expand=0&rev=72
This commit is contained in:
parent
bf532067bf
commit
f7eb959efb
26
tcsh-6.20.00-avoid-dotlock-for-fcntl.patch
Normal file
26
tcsh-6.20.00-avoid-dotlock-for-fcntl.patch
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
sh.hist.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- sh.hist.c
|
||||
+++ sh.hist.c 2017-07-19 10:01:20.795354927 +0000
|
||||
@@ -1278,6 +1278,11 @@ rechist(Char *fname, int ref)
|
||||
}
|
||||
|
||||
if (merge) {
|
||||
+#if 0 /* We are using fcntl's F_SETLKW patch for locking
|
||||
+ * therefore avoid dot file locking without holding
|
||||
+ * a file descriptor as otherwise we migth not be
|
||||
+ * able to open the history file after a crash or
|
||||
+ * if a killall had been used during reboot. */
|
||||
if (lock) {
|
||||
#ifndef WINNT_NATIVE
|
||||
char *lockpath = strsave(short2str(fname));
|
||||
@@ -1287,6 +1292,7 @@ rechist(Char *fname, int ref)
|
||||
cleanup_push(lockpath, dotlock_cleanup);
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
/* Read .history file, leave it's fd open for writing. */
|
||||
fd = loadhist(fname, HIST_MERGE|HIST_FILE_WRLCK|HIST_FILE_OPEN|HIST_FILE_LOCK);
|
||||
if (fd > 0) {
|
86
tcsh-closem.patch
Normal file
86
tcsh-closem.patch
Normal file
@ -0,0 +1,86 @@
|
||||
[PATCH] Slightly less drastic closem()
|
||||
Miloslav Trmac mitr at volny.cz
|
||||
Thu Sep 9 19:17:10 EDT 2004
|
||||
|
||||
Previous message: [PATCH] Slightly less drastic closem()
|
||||
Next message: Newlines in command substitution
|
||||
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
|
||||
|
||||
On Wed, Sep 08, 2004 at 08:38:03PM -0400, Christos Zoulas wrote:
|
||||
(Original mail reordered)
|
||||
> Finally, I do have an old patch that makes tcsh not use closem at all,
|
||||
> and adds sh like I/O redirection (plus other fd manipulations) to it,
|
||||
sh-like I/O redirection could actually make the problem worse if
|
||||
tcsh is using NSS after performing the redirections --- I haven't checked
|
||||
whether it does.
|
||||
|
||||
Avoiding closem () completely is of course the "correct" fix, but I'm
|
||||
afraid I won't be able to spend the time needed to do this.
|
||||
|
||||
|
||||
> The same problem has been present for years with NIS. Same as with nss_ldap,
|
||||
> NIS happily discovers that the fd it was using before is gone, and re-opens
|
||||
> it.
|
||||
Are other file types than sockets involved?
|
||||
|
||||
> I don't like the socket hack because:
|
||||
>
|
||||
> 1. It makes closem not close all the fds anymore.
|
||||
I have already argued this should not be a problem: tcsh never
|
||||
creates sockets.
|
||||
|
||||
> 3. the message that nss_ldap produces should be log_debug at best.
|
||||
I can imagine scenarios where the message is really useful, but
|
||||
I don't feel strongly about it.
|
||||
|
||||
> 2. The fact that nss_ldap uses sockets now is an artifact of the
|
||||
> implementation. What if tomorrow it changes to use doors or named pipes?
|
||||
I have never met doors in practice so I won't comment on them except by
|
||||
noting that the nss_ldap in question surely won't use them.
|
||||
|
||||
If nss_ldap used named pipes, the "it is necessary for performance"
|
||||
justification would be so weak that I would prefer patching nss_ldap
|
||||
to close the pipe after each call instead of changing tcsh.
|
||||
|
||||
nss_ldap and tcsh are fighting over a gray area in the
|
||||
system <-> application contract, so it seems reasonable to
|
||||
solve it by a "compromise", restricting the behavior of both.
|
||||
|
||||
|
||||
AFAICS, solving the general case reliably would require a lot of work
|
||||
and I have no emprical evidence suggesting that this work is necessary.
|
||||
|
||||
To make this lobbying attempt complete :-), I'm attaching a properly
|
||||
commented socket hack patch.
|
||||
Mirek
|
||||
---
|
||||
sh.misc.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
--- sh.misc.c
|
||||
+++ sh.misc.c 2017-06-16 07:51:59.732399828 +0000
|
||||
@@ -257,6 +257,7 @@ void
|
||||
closem(void)
|
||||
{
|
||||
int f, num_files;
|
||||
+ struct stat st;
|
||||
|
||||
#ifdef NLS_BUGS
|
||||
#ifdef NLS_CATALOGS
|
||||
@@ -274,6 +275,16 @@ closem(void)
|
||||
#ifdef MALLOC_TRACE
|
||||
&& f != 25
|
||||
#endif /* MALLOC_TRACE */
|
||||
+#ifdef S_ISSOCK
|
||||
+ /* NSS modules (e.g. Linux nss_ldap) might keep sockets open.
|
||||
+ * If we close such a socket, both the NSS module and tcsh think
|
||||
+ * they "own" the descriptor.
|
||||
+ *
|
||||
+ * Not closing sockets does not make the cleanup use of closem()
|
||||
+ * less reliable because tcsh never creates sockets.
|
||||
+ */
|
||||
+ && fstat(f, &st) == 0 && !S_ISSOCK(st.st_mode)
|
||||
+#endif
|
||||
)
|
||||
{
|
||||
xclose(f);
|
16
tcsh.changes
16
tcsh.changes
@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 19 10:25:40 UTC 2017 - werner@suse.de
|
||||
|
||||
- Add patch tcsh-6.20.00-avoid-dotlock-for-fcntl.patch as we are
|
||||
using fcntl's F_SETLKW patches for locking therefore avoid dot
|
||||
file locking without holding a file descriptor as otherwise we
|
||||
migth not be able to open the history file after a crash or if
|
||||
a killall had been used during reboot.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 16 07:54:55 UTC 2017 - werner@suse.de
|
||||
|
||||
- Add patch tcsh-closem.patch to fix a long standing misbehaviour
|
||||
of upstram tcsh whic his that it close sockets which do not
|
||||
belong to it (bsc#1028864)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 28 08:11:47 UTC 2017 - werner@suse.de
|
||||
|
||||
|
@ -43,6 +43,10 @@ Patch12: tcsh-6.20-rmstar.patch
|
||||
Patch13: tcsh-6.20-ptr-update.patch
|
||||
# PATCH-FIX-SUSE Do not convert current used control bytes into wide characters
|
||||
Patch14: tcsh-6.20.00-8bit-cmdkeys.patch
|
||||
# PATCH-FIX-COMMUNITY Slightly less drastic closem() -- bsc#1028864
|
||||
Patch15: tcsh-closem.patch
|
||||
# PATCH-FIX-SUSE Aoid dot locking as patch 9 and 11 do the job better
|
||||
Patch16: tcsh-6.20.00-avoid-dotlock-for-fcntl.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: ncurses-devel
|
||||
@ -74,6 +78,8 @@ correction, a history mechanism, job control, and a C-like syntax.
|
||||
%patch12 -p1 -b .rmstar
|
||||
%patch13 -p0 -b .ptrbuf
|
||||
%patch14 -p0 -b .8bit
|
||||
%patch15 -p0 -b .nss
|
||||
%patch16 -p0 -b .nodtlck
|
||||
%patch0 -b .0
|
||||
|
||||
%build
|
||||
|
Loading…
Reference in New Issue
Block a user