~kennylevinsen/seatd-devel

seatd-launch: disable getopt reordering v1 PROPOSED

Alyssa Ross: 1
 seatd-launch: disable getopt reordering

 4 files changed, 4 insertions(+), 4 deletions(-)



          
          
          
          
Next
The guideline 3 says:
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/seatd-devel/patches/39991/mbox | git am -3
Learn more about email & git

[PATCH] seatd-launch: disable getopt reordering Export this patch

Programs designed to chainload, similar to seatd-launch, like sudo or
the execline suite usually disable GNU getopt argument reordering,
because it is far more likely that if a user runs something like
"seatd-launch sway -d", they want the -d to do to sway rather than
seatd.  This removes the need to pass "--" to seatd-launch in most
cases.  I would be surprised if people were relying on the old
behaviour of flags given after the command being interpreted by seatd
instead of the command.
---
 .builds/alpine.yml          | 2 +-
 .builds/archlinux.yml       | 2 +-
 .builds/freebsd.yml         | 2 +-
 seatd-launch/seatd-launch.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.builds/alpine.yml b/.builds/alpine.yml
index 7e59203..5b94cc9 100644
--- a/.builds/alpine.yml
+++ b/.builds/alpine.yml
@@ -20,7 +20,7 @@ tasks:
      ninja -C build scan-build
      [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ]
   - smoketest: |
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug -- ./build/simpletest /dev/dri/card0
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug ./build/simpletest /dev/dri/card0
   - smoketest-builtin: |
      timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/dri/card0
   - check-format: |
diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml
index 185d232..f631e4b 100644
--- a/.builds/archlinux.yml
+++ b/.builds/archlinux.yml
@@ -19,7 +19,7 @@ tasks:
      ninja -C build scan-build
      [ -z "$(ls -A build/meson-logs/scanbuild/ 2>/dev/null)" ]
   - smoketest: |
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug -- ./build/simpletest /dev/input/event0
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug ./build/simpletest /dev/input/event0
   - smoketest-builtin: |
      timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/input/event0
   - smoketest-logind: |
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml
index c8f9618..6edce20 100644
--- a/.builds/freebsd.yml
+++ b/.builds/freebsd.yml
@@ -15,6 +15,6 @@ tasks:
      meson -Db_lundef=false -Db_sanitize=address -Dlibseat-seatd=enabled -Dlibseat-builtin=enabled -Dexamples=enabled -Dlibseat-logind=disabled build seatd
      ninja -C build
      sudo ninja -C build install
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug -- ./build/simpletest /dev/input/event0
      timeout -s KILL 30s sudo ./build/seatd-launch -l debug ./build/simpletest /dev/input/event0
   - smoketest-builtin: |
      timeout -s KILL 30s sudo LIBSEAT_BACKEND=builtin ./build/simpletest /dev/input/event0
diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c
index 65d4f33..de30673 100644
--- a/seatd-launch/seatd-launch.c
+++ b/seatd-launch/seatd-launch.c
@@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {

	int c;
	char loglevel[16] = "info";
	while ((c = getopt(argc, argv, "vhl:")) != -1) {
	while ((c = getopt(argc, argv, "+vhl:")) != -1) {
		switch (c) {
		case 'l':
			strncpy(loglevel, optarg, sizeof loglevel);

base-commit: 3e0d510b2c46eb18ab7239b029e01475eb2e3810
-- 
2.37.1
This is not POSIX. That is, on a POSIX-compliant libc, "+" is not a valid
character to pass to getopt.