Hello community, here is the log from the commit of package tcsh for openSUSE:Factory checked in at 2020-02-21 16:40:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/tcsh (Old) and /work/SRC/openSUSE:Factory/.tcsh.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tcsh" Fri Feb 21 16:40:36 2020 rev:70 rq:774849 version:6.22.02 Changes: -------- --- /work/SRC/openSUSE:Factory/tcsh/tcsh.changes 2020-01-11 14:37:19.629120388 +0100 +++ /work/SRC/openSUSE:Factory/.tcsh.new.26092/tcsh.changes 2020-02-21 16:41:19.929910064 +0100 @@ -1,0 +2,6 @@ +Mon Feb 17 11:19:42 UTC 2020 - Dr. Werner Fink <[email protected]> + +- Add temporary patch tcsh-6.22.02-local-dotlock.dif to avoid + dead locks at login after a reboot to left dot locking files + +------------------------------------------------------------------- New: ---- tcsh-6.22.02-local-dotlock.dif ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ tcsh.spec ++++++ --- /var/tmp/diff_new_pack.imqv8v/_old 2020-02-21 16:41:20.821911846 +0100 +++ /var/tmp/diff_new_pack.imqv8v/_new 2020-02-21 16:41:20.837911878 +0100 @@ -33,6 +33,7 @@ Patch5: tcsh-6.17.06-dspmbyte.dif Patch6: tcsh-6.18.03-catalogs.dif Patch7: tcsh-6.22.02-workaround-common.patch +Patch8: tcsh-6.22.02-local-dotlock.dif BuildRequires: autoconf BuildRequires: fdupes BuildRequires: ncurses-devel @@ -59,6 +60,7 @@ %patch5 -b .dspmbyte %patch6 -b .catalogs %patch7 -p 1 -b .workaround +%patch8 -p 0 -b .dotlock %patch0 -b .0 %build ++++++ tcsh-6.22.02-local-dotlock.dif ++++++ Avoid left over dot lock file after reboot --- dotlock.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) --- dotlock.c +++ dotlock.c 2020-02-17 11:16:22.785018224 +0000 @@ -30,8 +30,38 @@ #define O_SYNC 0 #endif +#if defined(__linux__) +# include <sys/statfs.h> +# include <unistd.h> +# ifndef TMPFS_MAGIC +# define TMPFS_MAGIC 0x01021994 +# endif +#endif + #include "dotlock.h" +#if defined(__linux__) +static char *sys_tmpdir; +static int +dosys_tmpdir () +{ + static char *shm = "/dev/shm"; + struct statfs fs; + static int doshm; + + if (doshm) + return (sys_tmpdir != NULL); + + doshm++; + + if (statfs(shm, &fs) < 0 || fs.f_type != TMPFS_MAGIC || eaccess(shm, W_OK|X_OK)) + return 0; + + sys_tmpdir = shm; + return 1; +} +#endif + static int create_exclusive(const char *); /* * Create a unique file. O_EXCL does not really work over NFS so we follow @@ -140,7 +170,17 @@ dot_lock(const char *fname, int pollinte (void)sigaddset(&nset, SIGTSTP); (void)sigaddset(&nset, SIGCHLD); +#if defined(__linux__) + const char *ptr; + if ((ptr = strrchr(fname, '/')) && dosys_tmpdir()) { + ptr++; + fname = ptr; + (void)snprintf(path, sizeof(path), "%s/%s.lock", sys_tmpdir, fname); + } else + (void)snprintf(path, sizeof(path), "%s.lock", fname); +#else (void)snprintf(path, sizeof(path), "%s.lock", fname); +#endif retval = -1; for (;;) { @@ -174,6 +214,16 @@ dot_unlock(const char *fname) { char path[MAXPATHLEN]; +#if defined(__linux__) + const char *ptr; + if ((ptr = strrchr(fname, '/')) && dosys_tmpdir()) { + ptr++; + fname = ptr; + (void)snprintf(path, sizeof(path), "%s/%s.lock", sys_tmpdir, fname); + } else + (void)snprintf(path, sizeof(path), "%s.lock", fname); +#else (void)snprintf(path, sizeof(path), "%s.lock", fname); +#endif (void)unlink(path); }
