Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to compile on systems that do not define TIOCSTI #494

Open
OscarL opened this issue May 19, 2023 · 3 comments
Open

Failure to compile on systems that do not define TIOCSTI #494

OscarL opened this issue May 19, 2023 · 3 comments

Comments

@OscarL
Copy link

OscarL commented May 19, 2023

Even if now most of the code has guards like in:

https://github.com/dvorka/hstr/blob/4dca4c72d7db104b2c1043551d0d8dc611e0e260/src/hstr_utils.c#146

There's still one spot where the usage of TIOCSTI is not guarded:

ioctl(0, TIOCSTI, c);


For context, found this while updating the Haiku port/package for hstr (still on 2.6 there). There, we mostly need to add || defined(__HAIKU__) on the same lines with WSL, CYGWIN to avoid TIOCSTI stuff, and next to FreeBSD (for the ncurse.h includes in that case).

Will try to come up with cleaner patches, to see if those can be upstreamed, but would be nice to see an official way for this missing "TIOCSTI guard".

Thanks for your work @dvorka!

@palves
Copy link

palves commented Jun 2, 2023

Just hit the same problem on Cygwin. I'm using this locally:

diff --git a/src/hstr_utils.c b/src/hstr_utils.c
index c37f3ed..89f1ea6 100644
--- a/src/hstr_utils.c
+++ b/src/hstr_utils.c
@@ -160,6 +160,7 @@ void tiocsti(void)
 void fill_terminal_input(char* cmd, bool padding)
 {
     if(cmd && strlen(cmd)>0) {
+#if 0
             if(is_tiocsti) {
             size_t size = strlen(cmd);
             unsigned i;
@@ -171,7 +172,9 @@ void fill_terminal_input(char* cmd, bool padding)
             }
             // echo, but don't flush to terminal
             if(padding) printf("\n");
-        } else {
+        } else
+#endif
+        {
             fprintf(stderr, "%s", cmd);
             if(padding) fprintf(stderr, "%s", "\n");
         }

@dvorka dvorka self-assigned this Aug 10, 2023
@dvorka dvorka added this to the 3.2 Stabilization milestone Aug 10, 2023
@dvorka
Copy link
Owner

dvorka commented Aug 10, 2023

@palves @OscarL thank you both for the bug report and fix! I will include it in the next release.

@dvorka dvorka added the :feelsgood: high label Aug 10, 2023
@OscarL
Copy link
Author

OscarL commented Aug 11, 2023

Thank you @dvorka!

For the record, here is the full patchset we apply to hstr 3.1 for the Haiku version:

https://github.com/haikuports/haikuports/blob/5db8076f6ff79cc44790092273ef0dc30f3a07e2/app-shells/hstr/patches/hstr-3.1.patchset

(just in case you find something useful)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants