All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] Feature request: print status messages to the terminal
@ 2021-10-26 21:54 Mansour Moufid
  2021-10-27  5:24 ` Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Mansour Moufid @ 2021-10-26 21:54 UTC (permalink / raw)
  To: cocci

Hello,

This is just a small thing, but at the moment spatch prints such
messages to stderr:

    $ spatch x.cocci --dir linux-5.14.5 2>errors.txt
    $ cat errors.txt
    HANDLING: linux-5.14.5/arch/alpha/boot/bootp.c
         (ONCE) already tagged but only removed, so safe
    diff =
    HANDLING: linux-5.14.5/arch/alpha/boot/bootpz.c
    diff =
    HANDLING: linux-5.14.5/arch/alpha/boot/main.c
    diff =
    ...

It would be nice if these lines were printed directly to the terminal.
That way, they would be visible, but not in stdout or stderr.

I use --very-quiet, but I do want to see these messages, just not in stderr.

Unfortunately I don't know OCaml, but here is how to use ctermid to
get a stream to the terminal:

    #include <assert.h>
    #include <stddef.h>
    #include <stdio.h> /* ctermid */
    #include <string.h>
    int main(void)
    {
        char *tty = ctermid(NULL);
        assert(tty != NULL && strlen(tty) > 0);
        FILE *f = fopen(tty, "w");
        if (f == NULL)
            perror(NULL);
        fprintf(f, "ctermid() == %s\n", tty);
        return 0;
    }

All the best.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-26 21:54 [cocci] Feature request: print status messages to the terminal Mansour Moufid
@ 2021-10-27  5:24 ` Julia Lawall
  2021-10-27 15:44   ` Mansour Moufid
  2021-10-27 17:45 ` [cocci] Print selected status messages to an other output target? Markus Elfring
  2021-10-30  9:39 ` [cocci] Feature request: print status messages to the terminal Julia Lawall
  2 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2021-10-27  5:24 UTC (permalink / raw)
  To: Mansour Moufid; +Cc: cocci



On Tue, 26 Oct 2021, Mansour Moufid wrote:

> Hello,
>
> This is just a small thing, but at the moment spatch prints such
> messages to stderr:
>
>     $ spatch x.cocci --dir linux-5.14.5 2>errors.txt
>     $ cat errors.txt
>     HANDLING: linux-5.14.5/arch/alpha/boot/bootp.c
>          (ONCE) already tagged but only removed, so safe
>     diff =
>     HANDLING: linux-5.14.5/arch/alpha/boot/bootpz.c
>     diff =
>     HANDLING: linux-5.14.5/arch/alpha/boot/main.c
>     diff =
>     ...
>
> It would be nice if these lines were printed directly to the terminal.
> That way, they would be visible, but not in stdout or stderr.
>
> I use --very-quiet, but I do want to see these messages, just not in stderr.

I don't want to see these messages.  I at most just want to record them
for future reference.  So I think we would need a new option to offer this
behavior.  What would you like it to be called?

julia

>
> Unfortunately I don't know OCaml, but here is how to use ctermid to
> get a stream to the terminal:
>
>     #include <assert.h>
>     #include <stddef.h>
>     #include <stdio.h> /* ctermid */
>     #include <string.h>
>     int main(void)
>     {
>         char *tty = ctermid(NULL);
>         assert(tty != NULL && strlen(tty) > 0);
>         FILE *f = fopen(tty, "w");
>         if (f == NULL)
>             perror(NULL);
>         fprintf(f, "ctermid() == %s\n", tty);
>         return 0;
>     }
>
> All the best.
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-27  5:24 ` Julia Lawall
@ 2021-10-27 15:44   ` Mansour Moufid
  2021-10-27 15:46     ` Julia Lawall
  0 siblings, 1 reply; 13+ messages in thread
From: Mansour Moufid @ 2021-10-27 15:44 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Wed, Oct 27, 2021 at 1:24 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> I don't want to see these messages.  I at most just want to record them
> for future reference.  So I think we would need a new option to offer this
> behavior.  What would you like it to be called?

I personally like --print-status or --no-status. I've seen other
command line utilities do something like --verbose=1, --verbose=2,
etc. I would be happy with either.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-27 15:44   ` Mansour Moufid
@ 2021-10-27 15:46     ` Julia Lawall
  2021-10-27 16:18       ` Mansour Moufid
  0 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2021-10-27 15:46 UTC (permalink / raw)
  To: Mansour Moufid; +Cc: cocci



On Wed, 27 Oct 2021, Mansour Moufid wrote:

> On Wed, Oct 27, 2021 at 1:24 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> > I don't want to see these messages.  I at most just want to record them
> > for future reference.  So I think we would need a new option to offer this
> > behavior.  What would you like it to be called?
>
> I personally like --print-status or --no-status. I've seen other
> command line utilities do something like --verbose=1, --verbose=2,
> etc. I would be happy with either.

--verbose-status ?

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-27 15:46     ` Julia Lawall
@ 2021-10-27 16:18       ` Mansour Moufid
  2021-10-27 17:31         ` Nicolas Palix
  0 siblings, 1 reply; 13+ messages in thread
From: Mansour Moufid @ 2021-10-27 16:18 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Wed, Oct 27, 2021 at 11:46 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> --verbose-status ?

Sounds good to me. :)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-27 16:18       ` Mansour Moufid
@ 2021-10-27 17:31         ` Nicolas Palix
  2021-10-27 17:32           ` Julia Lawall
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Palix @ 2021-10-27 17:31 UTC (permalink / raw)
  To: Mansour Moufid, Julia Lawall; +Cc: cocci

Hi,

On 27/10/2021 18:18, Mansour Moufid wrote:
> On Wed, Oct 27, 2021 at 11:46 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>>
>> --verbose-status ?
> 
> Sounds good to me. :)
> 

For the record.

ctermid is in the extunix library.

module U = ExtUnix.Specific

let _ =
         let tty = U.ctermid () in
         Printf.printf "%s\n"  tty;
         let tty_ch = open_out tty in
         output_string tty_ch "Hello\n";
         close_out tty_ch

$ dune exec ./ctermid.exe
Hello
/dev/tty

$ dune exec ./ctermid.exe > /dev/null
Hello


-- 
Nicolas Palix

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-27 17:31         ` Nicolas Palix
@ 2021-10-27 17:32           ` Julia Lawall
  0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2021-10-27 17:32 UTC (permalink / raw)
  To: Nicolas Palix; +Cc: Mansour Moufid, cocci



On Wed, 27 Oct 2021, Nicolas Palix wrote:

> Hi,
>
> On 27/10/2021 18:18, Mansour Moufid wrote:
> > On Wed, Oct 27, 2021 at 11:46 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> > >
> > > --verbose-status ?
> >
> > Sounds good to me. :)
> >
>
> For the record.
>
> ctermid is in the extunix library.
>
> module U = ExtUnix.Specific
>
> let _ =
>         let tty = U.ctermid () in
>         Printf.printf "%s\n"  tty;
>         let tty_ch = open_out tty in
>         output_string tty_ch "Hello\n";
>         close_out tty_ch
>
> $ dune exec ./ctermid.exe
> Hello
> /dev/tty
>
> $ dune exec ./ctermid.exe > /dev/null
> Hello

Thanks!

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Print selected status messages to an other output target?
  2021-10-26 21:54 [cocci] Feature request: print status messages to the terminal Mansour Moufid
  2021-10-27  5:24 ` Julia Lawall
@ 2021-10-27 17:45 ` Markus Elfring
  2021-10-30  9:39 ` [cocci] Feature request: print status messages to the terminal Julia Lawall
  2 siblings, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2021-10-27 17:45 UTC (permalink / raw)
  To: Mansour Moufid; +Cc: cocci

> I use --very-quiet, but I do want to see these messages,

Why do you see a need to handle a message selection in a special way?


> just not in stderr.

Would you like to become able to specify any other output channel
(according to your data processing requirements)?

Regards,
Markus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-26 21:54 [cocci] Feature request: print status messages to the terminal Mansour Moufid
  2021-10-27  5:24 ` Julia Lawall
  2021-10-27 17:45 ` [cocci] Print selected status messages to an other output target? Markus Elfring
@ 2021-10-30  9:39 ` Julia Lawall
  2021-10-30 16:30   ` Mansour Moufid
  2 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2021-10-30  9:39 UTC (permalink / raw)
  To: Mansour Moufid; +Cc: cocci

Hello,

I'm still trying to understand what is the real goal for this issue, to
see if it could be handled in some other way.  Do you want status messages
to be separated from real errors?  Perhaps it would be sufficient to have
an option that would put the status messages on standard out?  Then you
could give the -o argument to put the generated patch into a file.

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-30  9:39 ` [cocci] Feature request: print status messages to the terminal Julia Lawall
@ 2021-10-30 16:30   ` Mansour Moufid
  2021-10-30 16:38     ` Julia Lawall
  0 siblings, 1 reply; 13+ messages in thread
From: Mansour Moufid @ 2021-10-30 16:30 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Sat, Oct 30, 2021 at 5:39 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> Hello,
>
> I'm still trying to understand what is the real goal for this issue, to
> see if it could be handled in some other way.  Do you want status messages
> to be separated from real errors?  Perhaps it would be sufficient to have
> an option that would put the status messages on standard out?  Then you
> could give the -o argument to put the generated patch into a file.

Sorry I didn't explain it well. I am using spatch in a script and
logging stderr to a temporary file to catch any errors. I just didn't
want the status messages to appear there because there are so many.
But I've worked around this by ignoring those lines. I don't think
anything on stdout should change. The current behaviour is fine, I
don't mind it that much.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
  2021-10-30 16:30   ` Mansour Moufid
@ 2021-10-30 16:38     ` Julia Lawall
  2021-10-31  7:48       ` [cocci] Print selected status messages to an other output target? Markus Elfring
  0 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2021-10-30 16:38 UTC (permalink / raw)
  To: Mansour Moufid; +Cc: cocci



On Sat, 30 Oct 2021, Mansour Moufid wrote:

> On Sat, Oct 30, 2021 at 5:39 AM Julia Lawall <julia.lawall@inria.fr> wrote:
> >
> > Hello,
> >
> > I'm still trying to understand what is the real goal for this issue, to
> > see if it could be handled in some other way.  Do you want status messages
> > to be separated from real errors?  Perhaps it would be sufficient to have
> > an option that would put the status messages on standard out?  Then you
> > could give the -o argument to put the generated patch into a file.
>
> Sorry I didn't explain it well. I am using spatch in a script and
> logging stderr to a temporary file to catch any errors. I just didn't
> want the status messages to appear there because there are so many.
> But I've worked around this by ignoring those lines. I don't think
> anything on stdout should change. The current behaviour is fine, I
> don't mind it that much.

OK, I think I will leave things as is, to avoid adding another option and
more dependencies.

Thanks for the suggestion.

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Print selected status messages to an other output target?
  2021-10-30 16:38     ` Julia Lawall
@ 2021-10-31  7:48       ` Markus Elfring
  0 siblings, 0 replies; 13+ messages in thread
From: Markus Elfring @ 2021-10-31  7:48 UTC (permalink / raw)
  To: Julia Lawall, Mansour Moufid; +Cc: cocci

>> Sorry I didn't explain it well. I am using spatch in a script and
>> logging stderr to a temporary file to catch any errors. I just didn't
>> want the status messages to appear there because there are so many.
>> But I've worked around this by ignoring those lines. I don't think
>> anything on stdout should change. The current behaviour is fine, I
>> don't mind it that much.
>
> OK, I think I will leave things as is, to avoid adding another option and
> more dependencies.

Will any related data processing requirements trigger the collateral evolution
to filter log output any more by their severity (or other categories)?
https://github.com/coccinelle/coccinelle/issues/

Regards,
Markus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [cocci] Feature request: print status messages to the terminal
@ 2021-10-30 10:55 Julia Lawall
  0 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2021-10-30 10:55 UTC (permalink / raw)
  To: Nicolas Palix; +Cc: cocci

On Sat, 30 Oct 2021, Nicolas Palix wrote:

> Hi,
>
> On 30/10/2021 11:39, Julia Lawall wrote:
> > Hello,
> >
> > I'm still trying to understand what is the real goal for this issue, to
> > see if it could be handled in some other way.  Do you want status messages
> > to be separated from real errors?  Perhaps it would be sufficient to have
> > an option that would put the status messages on standard out?  Then you
> > could give the -o argument to put the generated patch into a file.
> >
>
> I think it could be a --log-output option.
> That way, it could be set from the command line to either a file or /dev/tty.
>
> I was also thinking of a --(show-)progress option otherwise.
>
> I think it's better to keep the default output for report/patch printing
> generated by the SmPL file.

OK, I'm not really concerned about the name of the option.  But I'm not
enthusiastic at all about adding yet another dependency, ie the library
you indicated.  The idea of an output that always appears on the screen
and is not capturable also feels fairly useless to me...

julia

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-10-31  7:48 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 21:54 [cocci] Feature request: print status messages to the terminal Mansour Moufid
2021-10-27  5:24 ` Julia Lawall
2021-10-27 15:44   ` Mansour Moufid
2021-10-27 15:46     ` Julia Lawall
2021-10-27 16:18       ` Mansour Moufid
2021-10-27 17:31         ` Nicolas Palix
2021-10-27 17:32           ` Julia Lawall
2021-10-27 17:45 ` [cocci] Print selected status messages to an other output target? Markus Elfring
2021-10-30  9:39 ` [cocci] Feature request: print status messages to the terminal Julia Lawall
2021-10-30 16:30   ` Mansour Moufid
2021-10-30 16:38     ` Julia Lawall
2021-10-31  7:48       ` [cocci] Print selected status messages to an other output target? Markus Elfring
2021-10-30 10:55 [cocci] Feature request: print status messages to the terminal Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.