folkertvanheusden / multitail

Tail on steroids
https://vanheusden.com/multitail/
MIT License
119 stars 13 forks source link

Issue on small systems which use tail from busybox #7

Open ThomasD13 opened 1 year ago

ThomasD13 commented 1 year ago

Hi guys,

I ported/created package for ARM Aarch64 v8, and would like to use it on slim linux systems which only have busybox. (embedded devices)

The issue here is, that tail from busybox does not know the --follow=name argument. Indeed it uses -f/-F for that.

I fixed this issue for me (quick & dirty) by patching this:

Date: Thu, 22 Sep 2022 10:14:09 +0200
Subject: [PATCH] Replaced tail argument --follow=name to -f, since the tail
 from busybox does not support --follow=name

---
 exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/exec.c b/exec.c
index 9cc2de7..ae18aed 100644
--- a/exec.c
+++ b/exec.c
@@ -83,7 +83,7 @@ int start_tail(char *filename, char retry_open, char follow_filename, int initia
                if (follow_filename)
                {
 #if defined(linux) || defined(__CYGWIN__) || defined(__GNU__)
-                       pars[npars++] = "--follow=name";
+                       pars[npars++] = "-f";
 #elif defined(__OpenBSD__)
                        pars[npars++] = "-f";
 #else
@@ -99,7 +99,7 @@ int start_tail(char *filename, char retry_open, char follow_filename, int initia
                {
 #if !defined(linux) && !defined(__CYGWIN__) && !defined(__GNU__)
                        if (follow_filename && gnu_tail)
-                               pars[npars++] = "--follow=name";
+                               pars[npars++] = "-f";
 #endif

                        /* check the posix compliance level */

I think a cleaner solution would be to add a #if-else case for busybox case here. But I wanted to share this patch with you anyway, maybe you want to implement something similar.

Greetings

folkertvanheusden commented 1 year ago

Thank you but I vaguely remember I used --follow=name for a reason. So a busybox specific fix would be preferred.

ThomasD13 commented 1 year ago

I can open an MR with a specific "busybox" fix, when I get time for this. Just asking for curiosity: Where does the definition "linux" got set?

Best regards, Thomas

folkertvanheusden commented 8 months ago

"linux" is set by the preprocessor I think