Ingo

indeed hyphens were OK, my programs are actually using underscores.

Patch seems fine to me, thank you very much. (I do not know how to submit 
patches so let me let competent people do it to not waste time)

Kawashima

2019/01/13 2:45、Ingo Schwarze <[email protected]>のメール:

> Hello Kawashima-san,
> 
> kawashima_james wrote on Sat, Jan 12, 2019 at 02:27:55AM +0900:
> 
>> syslogd uses isalnum(3) to extract the program name from log lines,
>> so it is not possible to filter for programs with -
> 
> If i read the source code in syslogd.c correctly, '-' is already
> supported, see below.
> 
>> or _ in their names like below
>> 
>> !my-program
>> # will never match because syslogd extracts only "my"
>> 
>> please kindly tell me if this is not a bug (if I should stop using
>> underscores or hyphens in my program names)
> 
> There is nothing wrong with underscores in program names.
> Actually, they appear to be quite common:
> 
>  $ ls {/usr,}/{s,}bin/*_*
> 
> The same is true for '.'.
> 
> So i'm proposing the following patch.
> Lightly tested, but it does not look dangerous,
> so i'm looking for OKs.
> 
> Thanks you for reporting and for your support!
> 
> Yours,
>  Ingo
> 
> 
> Index: syslogd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
> retrieving revision 1.257
> diff -u -p -r1.257 syslogd.c
> --- syslogd.c    29 Nov 2018 21:10:51 -0000    1.257
> +++ syslogd.c    12 Jan 2019 17:35:14 -0000
> @@ -1796,7 +1796,8 @@ logline(int pri, int flags, char *from, 
>        msglen--;
>    }
>    for (i = 0; i < NAME_MAX; i++) {
> -        if (!isalnum((unsigned char)msg[i]) && msg[i] != '-')
> +        if (!isalnum((unsigned char)msg[i]) &&
> +            msg[i] != '-' && msg[i] != '.' && msg[i] != '_')
>            break;
>        prog[i] = msg[i];
>    }

Reply via email to