[sanlock] branch master updated: avoid non-portable "which" to detect
installed programs
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
The following commit(s) were added to refs/heads/master by this push:
new 10a9538 avoid non-portable "which" to detect installed programs
10a9538 is described below
commit 10a95386ab13c5f981562f91fc122a5e616725b0
Author: Eli Schwartz <eschwartz93(a)gmail.com>
AuthorDate: Fri Mar 29 09:24:49 2024 -0500
avoid non-portable "which" to detect installed programs
The "which" utility is not guaranteed to be installed either, and if it
is, its behavior is not portable either. This means that when various
programs are installed, the which check will report a fatal error
because the which tool did not exist and the shell returned a nonzero
status when attempting to fork+exec. If it did exist, it might not be an
implementation of which that returns nonzero when commands do not exist.
The general scripting suggestion is to use the "command -v" shell
builtin; this is required to exist in all POSIX 2008 compliant shells,
and is thus guaranteed to work everywhere.
For some in-depth discussions on the topic, see:
- https://mywiki.wooledge.org/BashFAQ/081
- https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-...
Examples of open-source shells likely to be installed as /bin/sh on
Linux, which implement the 15-year-old standard: ash, bash, busybox,
dash, ksh, mksh and zsh.
Several Linux distros which do currently ship a (decent quality) which
utility in their default install are looking to get rid of it:
- Gentoo: https://bugs.gentoo.org/646588
- Debian: https://lwn.net/Articles/874049/
In this case, we know that "install" exists. If it doesn't, the Makefile
abnormally aborts, since $(INSTALL) expands empty and `make install`
fails. Anyways, it is installed by coreutils.
There's no point in converting it to an absolute path inside a Makefile
invocation. The only reason it is a variable at all is so that users can
override it. The only thing setting it to the value of running (on every
single make) a subprocess for $(shell which install) *does*, is
potentially mess up when this arbitrary dependency isn't available.
Just default to calling it without a path.
Signed-off-by: Eli Schwartz <eschwartz93(a)gmail.com>
---
fence_sanlock/Makefile | 2 +-
reset/Makefile | 2 +-
src/Makefile | 2 +-
wdmd/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fence_sanlock/Makefile b/fence_sanlock/Makefile
index 6e2aa9b..14bbe13 100644
--- a/fence_sanlock/Makefile
+++ b/fence_sanlock/Makefile
@@ -51,7 +51,7 @@ $(TARGET2): $(SOURCE2)
clean:
rm -f *.o *.so *.so.* $(TARGET1) $(TARGET2)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/reset/Makefile b/reset/Makefile
index 004dbb6..1bc370c 100644
--- a/reset/Makefile
+++ b/reset/Makefile
@@ -26,7 +26,7 @@ $(TARGET2): $(SOURCE2)
clean:
rm -f *.o *.so *.so.* $(TARGET1) $(TARGET2)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/src/Makefile b/src/Makefile
index 533dd79..c0ef517 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -107,7 +107,7 @@ $(LIBPC_CLIENT_TARGET): $(LIBPC_CLIENT_SOURCE)
clean:
rm -f *.o *.so *.so.* $(CMD_TARGET) $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/wdmd/Makefile b/wdmd/Makefile
index 5849efc..bf5b698 100644
--- a/wdmd/Makefile
+++ b/wdmd/Makefile
@@ -52,7 +52,7 @@ clean:
rm -f *.o *.so *.so.* $(CMD_TARGET) $(TEST_TARGET)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 weeks, 1 day
[PATCH] avoid non-portable "which" to detect installed programs
by Eli Schwartz
The "which" utility is not guaranteed to be installed either, and if it
is, its behavior is not portable either. This means that when various
programs are installed, the which check will report a fatal error
because the which tool did not exist and the shell returned a nonzero
status when attempting to fork+exec. If it did exist, it might not be an
implementation of which that returns nonzero when commands do not exist.
The general scripting suggestion is to use the "command -v" shell
builtin; this is required to exist in all POSIX 2008 compliant shells,
and is thus guaranteed to work everywhere.
For some in-depth discussions on the topic, see:
- https://mywiki.wooledge.org/BashFAQ/081
- https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-...
Examples of open-source shells likely to be installed as /bin/sh on
Linux, which implement the 15-year-old standard: ash, bash, busybox,
dash, ksh, mksh and zsh.
Several Linux distros which do currently ship a (decent quality) which
utility in their default install are looking to get rid of it:
- Gentoo: https://bugs.gentoo.org/646588
- Debian: https://lwn.net/Articles/874049/
In this case, we know that "install" exists. If it doesn't, the Makefile
abnormally aborts, since $(INSTALL) expands empty and `make install`
fails. Anyways, it is installed by coreutils.
There's no point in converting it to an absolute path inside a Makefile
invocation. The only reason it is a variable at all is so that users can
override it. The only thing setting it to the value of running (on every
single make) a subprocess for $(shell which install) *does*, is
potentially mess up when this arbitrary dependency isn't available.
Just default to calling it without a path.
Signed-off-by: Eli Schwartz <eschwartz93(a)gmail.com>
---
fence_sanlock/Makefile | 2 +-
reset/Makefile | 2 +-
src/Makefile | 2 +-
wdmd/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fence_sanlock/Makefile b/fence_sanlock/Makefile
index 6e2aa9b..14bbe13 100644
--- a/fence_sanlock/Makefile
+++ b/fence_sanlock/Makefile
@@ -51,7 +51,7 @@ $(TARGET2): $(SOURCE2)
clean:
rm -f *.o *.so *.so.* $(TARGET1) $(TARGET2)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/reset/Makefile b/reset/Makefile
index 004dbb6..1bc370c 100644
--- a/reset/Makefile
+++ b/reset/Makefile
@@ -26,7 +26,7 @@ $(TARGET2): $(SOURCE2)
clean:
rm -f *.o *.so *.so.* $(TARGET1) $(TARGET2)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/src/Makefile b/src/Makefile
index 533dd79..c0ef517 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -107,7 +107,7 @@ $(LIBPC_CLIENT_TARGET): $(LIBPC_CLIENT_SOURCE)
clean:
rm -f *.o *.so *.so.* $(CMD_TARGET) $(LIBSO_ENTIRE_TARGET) $(LIBSO_CLIENT_TARGET) $(LIBPC_ENTIRE_TARGET) $(LIBPC_CLIENT_TARGET)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
diff --git a/wdmd/Makefile b/wdmd/Makefile
index 5849efc..bf5b698 100644
--- a/wdmd/Makefile
+++ b/wdmd/Makefile
@@ -52,7 +52,7 @@ clean:
rm -f *.o *.so *.so.* $(CMD_TARGET) $(TEST_TARGET)
-INSTALL=$(shell which install)
+INSTALL=install
DESTDIR=
BINDIR=/usr/sbin
--
2.43.2
4 weeks, 1 day
[sanlock] 01/02: sanlock: fix zero io timeout for direct requests
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 58281a950e91cf0bdb5e93f019358905a84a0012
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 19 11:14:24 2024 -0500
sanlock: fix zero io timeout for direct requests
---
src/direct.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/direct.c b/src/direct.c
index 73861a2..f70dc19 100644
--- a/src/direct.c
+++ b/src/direct.c
@@ -135,6 +135,8 @@ static int do_paxos_action(int action, struct task *task, int io_timeout, struct
if (!io_timeout)
io_timeout = com.io_timeout;
+ if (!io_timeout)
+ io_timeout = DEFAULT_IO_TIMEOUT;
rv = sizes_from_flags(res->flags, §or_size, &align_size, &max_hosts, "RES");
if (rv)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
1 month, 1 week