linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] procfs: fix the output format in /proc/PID/wchan
@ 2018-11-19 11:17 Yafang Shao
  2018-11-22  3:28 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Yafang Shao @ 2018-11-19 11:17 UTC (permalink / raw)
  To: adobriyan, akpm, viro, keescook, orcunov
  Cc: linux-kernel, linux-fsdevel, Yafang Shao

Just add the missing newline.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 fs/proc/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index ce34654..d7f49fb 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 	wchan = get_wchan(task);
 	if (wchan && !lookup_symbol_name(wchan, symname)) {
 		seq_puts(m, symname);
+		seq_putc(m, '\n');
 		return 0;
 	}
 
 print0:
-	seq_putc(m, '0');
+	seq_puts(m, "0\n");
 	return 0;
 }
 #endif /* CONFIG_KALLSYMS */
-- 
1.8.3.1


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

* Re: [PATCH] procfs: fix the output format in /proc/PID/wchan
  2018-11-19 11:17 [PATCH] procfs: fix the output format in /proc/PID/wchan Yafang Shao
@ 2018-11-22  3:28 ` Andrew Morton
  2018-11-22 11:40   ` Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2018-11-22  3:28 UTC (permalink / raw)
  To: Yafang Shao
  Cc: adobriyan, viro, keescook, orcunov, linux-kernel, linux-fsdevel

On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:

> Just add the missing newline.
> 
> ...
>
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
>  	wchan = get_wchan(task);
>  	if (wchan && !lookup_symbol_name(wchan, symname)) {
>  		seq_puts(m, symname);
> +		seq_putc(m, '\n');
>  		return 0;
>  	}
>  
>  print0:
> -	seq_putc(m, '0');
> +	seq_puts(m, "0\n");
>  	return 0;
>  }
>  #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output?  The changelog
should explain such things, please.

Providing example output with the patch unapplied and then with the
patch applied would help us to understand the patch's effect.

Thanks.

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

* Re: [PATCH] procfs: fix the output format in /proc/PID/wchan
  2018-11-22  3:28 ` Andrew Morton
@ 2018-11-22 11:40   ` Alexey Dobriyan
  2018-11-22 13:29     ` Yafang Shao
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2018-11-22 11:40 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Yafang Shao, viro, keescook, orcunov, linux-kernel, linux-fsdevel

On Wed, Nov 21, 2018 at 07:28:44PM -0800, Andrew Morton wrote:
> On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:
>
> > Just add the missing newline.
> >
> > ...
> >
> > --- a/fs/proc/base.c
> > +++ b/fs/proc/base.c
> > @@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
> >  	wchan = get_wchan(task);
> >  	if (wchan && !lookup_symbol_name(wchan, symname)) {
> >  		seq_puts(m, symname);
> > +		seq_putc(m, '\n');
> >  		return 0;
> >  	}
> >
> >  print0:
> > -	seq_putc(m, '0');
> > +	seq_puts(m, "0\n");
> >  	return 0;
> >  }
> >  #endif /* CONFIG_KALLSYMS */
>
> What is presently wrong with the wchan output?  The changelog
> should explain such things, please.

It is just newline to make "cat /proc/*/wchan" output look cool.
But newline can break something.

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

* Re: [PATCH] procfs: fix the output format in /proc/PID/wchan
  2018-11-22 11:40   ` Alexey Dobriyan
@ 2018-11-22 13:29     ` Yafang Shao
  2018-11-22 13:38       ` Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: Yafang Shao @ 2018-11-22 13:29 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: Andrew Morton, viro, Kees Cook, LKML, linux-fsdevel

On Thu, Nov 22, 2018 at 7:40 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> On Wed, Nov 21, 2018 at 07:28:44PM -0800, Andrew Morton wrote:
> > On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:
> >
> > > Just add the missing newline.
> > >
> > > ...
> > >
> > > --- a/fs/proc/base.c
> > > +++ b/fs/proc/base.c
> > > @@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
> > >     wchan = get_wchan(task);
> > >     if (wchan && !lookup_symbol_name(wchan, symname)) {
> > >             seq_puts(m, symname);
> > > +           seq_putc(m, '\n');
> > >             return 0;
> > >     }
> > >
> > >  print0:
> > > -   seq_putc(m, '0');
> > > +   seq_puts(m, "0\n");
> > >     return 0;
> > >  }
> > >  #endif /* CONFIG_KALLSYMS */
> >
> > What is presently wrong with the wchan output?  The changelog
> > should explain such things, please.
>
> It is just newline to make "cat /proc/*/wchan" output look cool.
> But newline can break something.

Could you pls. show some examples for what the newline may break ?

Thanks
Yafang

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

* Re: [PATCH] procfs: fix the output format in /proc/PID/wchan
  2018-11-22 13:29     ` Yafang Shao
@ 2018-11-22 13:38       ` Alexey Dobriyan
  2018-11-23  9:57         ` Yafang Shao
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2018-11-22 13:38 UTC (permalink / raw)
  To: Yafang Shao; +Cc: Andrew Morton, viro, Kees Cook, LKML, linux-fsdevel

On Thu, Nov 22, 2018 at 09:29:52PM +0800, Yafang Shao wrote:
> On Thu, Nov 22, 2018 at 7:40 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
> >
> > On Wed, Nov 21, 2018 at 07:28:44PM -0800, Andrew Morton wrote:
> > > On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:
> > >
> > > > Just add the missing newline.
> > > >
> > > > ...
> > > >
> > > > --- a/fs/proc/base.c
> > > > +++ b/fs/proc/base.c
> > > > @@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
> > > >     wchan = get_wchan(task);
> > > >     if (wchan && !lookup_symbol_name(wchan, symname)) {
> > > >             seq_puts(m, symname);
> > > > +           seq_putc(m, '\n');
> > > >             return 0;
> > > >     }
> > > >
> > > >  print0:
> > > > -   seq_putc(m, '0');
> > > > +   seq_puts(m, "0\n");
> > > >     return 0;
> > > >  }
> > > >  #endif /* CONFIG_KALLSYMS */
> > >
> > > What is presently wrong with the wchan output?  The changelog
> > > should explain such things, please.
> >
> > It is just newline to make "cat /proc/*/wchan" output look cool.
> > But newline can break something.
> 
> Could you pls. show some examples for what the newline may break ?

	char buf[16];
	rv = read(fd, buf, sizeof(buf));
	assert(rv == 1);

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

* Re: [PATCH] procfs: fix the output format in /proc/PID/wchan
  2018-11-22 13:38       ` Alexey Dobriyan
@ 2018-11-23  9:57         ` Yafang Shao
  0 siblings, 0 replies; 6+ messages in thread
From: Yafang Shao @ 2018-11-23  9:57 UTC (permalink / raw)
  To: Alexey Dobriyan, Andrew Morton; +Cc: viro, Kees Cook, LKML, linux-fsdevel

On Thu, Nov 22, 2018 at 9:38 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> On Thu, Nov 22, 2018 at 09:29:52PM +0800, Yafang Shao wrote:
> > On Thu, Nov 22, 2018 at 7:40 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
> > >
> > > On Wed, Nov 21, 2018 at 07:28:44PM -0800, Andrew Morton wrote:
> > > > On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <laoar.shao@gmail.com> wrote:
> > > >
> > > > > Just add the missing newline.
> > > > >
> > > > > ...
> > > > >
> > > > > --- a/fs/proc/base.c
> > > > > +++ b/fs/proc/base.c
> > > > > @@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
> > > > >     wchan = get_wchan(task);
> > > > >     if (wchan && !lookup_symbol_name(wchan, symname)) {
> > > > >             seq_puts(m, symname);
> > > > > +           seq_putc(m, '\n');
> > > > >             return 0;
> > > > >     }
> > > > >
> > > > >  print0:
> > > > > -   seq_putc(m, '0');
> > > > > +   seq_puts(m, "0\n");
> > > > >     return 0;
> > > > >  }
> > > > >  #endif /* CONFIG_KALLSYMS */
> > > >
> > > > What is presently wrong with the wchan output?  The changelog
> > > > should explain such things, please.
> > >
> > > It is just newline to make "cat /proc/*/wchan" output look cool.
> > > But newline can break something.
> >
> > Could you pls. show some examples for what the newline may break ?
>
>         char buf[16];
>         rv = read(fd, buf, sizeof(buf));
>         assert(rv == 1);

That's really a break, so we can't apply this patch.

Hi Andrew,
I found that you have applied this patch to -mm tree, could you pls.
help revert it as it may break something ?

Thanks
Yafang

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

end of thread, other threads:[~2018-11-23  9:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-19 11:17 [PATCH] procfs: fix the output format in /proc/PID/wchan Yafang Shao
2018-11-22  3:28 ` Andrew Morton
2018-11-22 11:40   ` Alexey Dobriyan
2018-11-22 13:29     ` Yafang Shao
2018-11-22 13:38       ` Alexey Dobriyan
2018-11-23  9:57         ` Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).