Re: svn commit: r336737 - head/usr.bin/top

2018-07-26 Thread via svn-src-head
I see. thank you for the advice!

> 2018/07/26 23:22、Rodney W. Grimes のメール:
> 
>> Author: daichi
>> Date: Thu Jul 26 13:53:22 2018
>> New Revision: 336737
>> URL: https://svnweb.freebsd.org/changeset/base/336737
>> 
>> Log:
>>  top(1): forgot in r336160
> 
> It is helpful to say what was forgot in the commit message as when
> you are reading a svn log output you do not have the diff to show
> you what it was that has been forgot.
> 
> Better message would of been:
>   Remove utf8strvisx prototype, forgotten in r336160
> 
> 
> Thanks,
> Rod
>> 
>>  Approved by:gnn (mentor)
>>  Differential Revision:  https://reviews.freebsd.org/D16452
>> 
>> Modified:
>>  head/usr.bin/top/utils.h
>> 
>> Modified: head/usr.bin/top/utils.h
>> ==
>> --- head/usr.bin/top/utils.h Thu Jul 26 13:33:10 2018(r336736)
>> +++ head/usr.bin/top/utils.h Thu Jul 26 13:53:22 2018(r336737)
>> @@ -22,5 +22,4 @@ const char *format_time(long);
>> char *format_k(int64_t);
>> int string_index(const char *string, const char * const *array);
>> int find_pid(pid_t pid);
>> -int utf8strvisx(char *, const char *, size_t);
>> 
>> 
>> 
> 
> -- 
> Rod Grimes rgri...@freebsd.org

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r335836 - head/usr.bin/top

2018-07-09 Thread via svn-src-head
I summarized in the Phabricator. Check it out please.

https://reviews.freebsd.org/D16203

> 2018/07/05 1:37、Hiroki Sato のメール:
> 
> Hiroki Sato  wrote
>  in <20180703.020956.859981414196673670@allbsd.org>:
> 
> hr> 後藤大地  wrote
> hr>   in <459bd898-8072-426e-a968-96c1382ac...@icloud.com>:
> hr>
> hr> da>
> hr> da>
> hr> da> > 2018/07/02 15:55、Hiroki Sato のメール:
> hr> da> >
> hr> da> > Eitan Adler  wrote
> hr> da> >  in 
> :
> hr> da> >
> hr> da> > li> On 1 July 2018 at 10:08, Conrad Meyer  wrote:
> hr> da> > li> > Hi Daichi,
> hr> da> > li> >
> hr> da> > li> >
> hr> da> > li> >
> hr> da> > li> > I don't think code to decode UTF-8 belongs in top(1).  I 
> don't know
> hr> da> > li> > what the goal of this routine is, but I doubt this is the 
> right way to
> hr> da> > li> > accomplish it.
> hr> da> > li>
> hr> da> > li> For the record, I agree. This is why I didn't click "accept" on 
> the
> hr> da> > li> revision. I don't fully oppose leaving it in top(1) for now as 
> we work
> hr> da> > li> out the API, but long term its the wrong place.
> hr> da> > li>
> hr> da> > li> https://reviews.freebsd.org/D16058 is the review.
> hr> da> >
> hr> da> > I strongly object this kind of encoding-specific routine.  Please
> hr> da> > back out it.  The problem is that top(1) does not support multibyte
> hr> da> > encoding in functions for printing, and using C99 wide/multibyte
> hr> da> > character manipulation API such as iswprint(3) is the way to solve
> hr> da> > it.  Doing getenv("LANG") and assuming an encoding based on it is a
> hr> da> > very bad practice to internationalize software.
> hr> da> >
> hr> da> > -- Hiroki
> hr> da>
> hr> da> I respect what you mean.
> hr> da>
> hr> da> Once I back out, I will begin implementing it in a different way.
> hr> da> Please advise which function should be used for implementation
> hr> da> (iswprint (3) and what other functions should be used?)
> hr>
> hr>  Roughly speaking, POSIX/XPG/C99 I18N model requires the following
> hr>  steps:
> (snip)
> 
> Are you going to back out r335836, or disagree about it?
> 
> If there is no objection in the next 24 hours, I will commit the
> attached patch.  This should be a minimal change to support multibyte
> characters in ARGV array depending on LC_CTYPE, not limited to UTF-8.
> 
> -- Hiroki
> Index: usr.bin/top/display.c
> ===
> --- usr.bin/top/display.c (revision 335957)
> +++ usr.bin/top/display.c (working copy)
> @@ -1248,55 +1248,6 @@
> }
> }
> 
> -/*
> - *  printable(str) - make the string pointed to by "str" into one that is
> - *   printable (i.e.: all ascii), by converting all non-printable
> - *   characters into '?'.  Replacements are done in place and a pointer
> - *   to the original buffer is returned.
> - */
> -
> -char *
> -printable(char str[])
> -{
> - char *ptr;
> - char ch;
> -
> - ptr = str;
> - if (utf8flag) {
> - while ((ch = *ptr) != '\0') {
> - if (0x00 == (0x80 & ch)) {
> - if (!isprint(ch)) {
> - *ptr = '?';
> - }
> - ++ptr;
> - } else if (0xC0 == (0xE0 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else if (0xE0 == (0xF0 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else if (0xF0 == (0xF8 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else {
> - *ptr = '?';
> - ++ptr;
> - }
> - }
> - } else {
> - while ((ch = *ptr) != '\0') {
> - if (!isprint(ch)) {
> - *ptr = '?';
> - }
> - ptr++;
> - }
> - }
> - return(str);
> -}
> -
> void
> i_uptime(struct timeval *bt, time_t *tod)
> {
> Index: usr.bin/top/display.h
> ===
> --- usr.bin/top/display.h (revision 335957)
> +++ usr.bin/top/display.h (working copy)
> @@ -11,7 +11,6 @@
> void   clear_message(void);
> intdisplay_resize(void);
> void   i_header(const char *text);
> -char *printable(char *string);
> void   display_header(int t);
> intdisplay_init(struct statics *statics);
> void   i_arc(int *stats);
> Index: usr.bin/top/machine.c
> ===
> --- usr.bin/top/machine.c (revision 335957)
> +++ usr.bin/top/machine.c (wor

Re: svn commit: r336028 - head/usr.bin/top

2018-07-07 Thread via svn-src-head

> 2018/07/07 8:53、Hiroki Sato のメール:
> 
> Daichi GOTO  wrote
>  in <201807061207.w66c76cr043...@repo.freebsd.org>:
> 
> da> Author: daichi
> da> Date: Fri Jul  6 12:07:06 2018
> da> New Revision: 336028
> da> URL: https://svnweb.freebsd.org/changeset/base/336028
> da>
> da> Log:
> da>   Changed to eliminate the upper limit of command length displayed
> da>   by "-a" and expand to match terminal width
> da>
> da>   Reviewed by:eadler
> da>   Approved by:gnn (mentor)
> da>   Differential Revision:  https://reviews.freebsd.org/D16083
> da>
> da> Modified:
> da>   head/usr.bin/top/display.c
> da>   head/usr.bin/top/machine.c
> da>   head/usr.bin/top/screen.c
> da>   head/usr.bin/top/top.h
> 
> This change breaks displaying a prompt and messages in the
> interactive mode by new_message() when typing "o" or "p", for
> example.  While r336031 fixed a warning in GCC, it does not fix the
> problem itself.  Please fix it.

OK. I will fix this problem first.


> I also think restructure of the buffer management is required first
> if we want to eliminate the column width limitation.  Using sbuf(9)
> consistently may be better than incomplete conversion from static
> arrays to malloc().

I understand. Switching to sbuf(9) is the next step.

> 
> -- Hiroki

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r336028 - head/usr.bin/top

2018-07-06 Thread via svn-src-head
Surely. I think your advice is appropriate.
Could you please commit?

> 2018/07/06 22:04、Sean Bruno のメール:
> 
> 
> 
> On 07/06/18 06:07, Daichi GOTO wrote:
>> -static char next_msg[MAX_COLS + 5];
>> +static char *next_msg = NULL;
>> static int msglen = 0;
>> /* Invariant: msglen is always the length of the message currently displayed
>>on the screen (even when next_msg doesn't contain that message). */
> 
> gcc noticed that a later call to vsnprintf() now has some problems.
> /home/sbruno/bsd/wifi/fbsd_head/usr.bin/top/display.c: In function
> 'new_message':
> /home/sbruno/bsd/wifi/fbsd_head/usr.bin/top/display.c:963:31: error:
> argument to 'sizeof' in 'vsnprintf' call is the same expression as the
> destination; did you mean to provide an explicit length?
> [-Werror=sizeof-pointer-memaccess]
> vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
> 
> 
> I think this needs to be changed
> 
> Index: usr.bin/top/display.c
> ===
> --- usr.bin/top/display.c   (revision 336029)
> +++ usr.bin/top/display.c   (working copy)
> @@ -960,7 +960,7 @@
> va_start(args, msgfmt);
> 
> /* first, format the message */
> -vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);
> +vsnprintf(next_msg, strlen(next_msg), msgfmt, args);
> 
> va_end(args);
> 

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r335836 - head/usr.bin/top

2018-07-04 Thread via svn-src-head
I think that’s fine.

I have not been committed for a while, so now I am in the state of
being reactive commit bit mentee under George’s mentor. So I sent 
him an e-mail about rollback, but I have not heard back from him yet. 
I have been waiting for a reply mail.

I planed to roll back as soon as permission comes out from him.  
However, I think that there is no problem with your commit.
Thank you.

Best regards,
Daichi

> 2018/07/05 1:37、Hiroki Sato のメール:
> 
> Hiroki Sato  wrote
>  in <20180703.020956.859981414196673670@allbsd.org>:
> 
> hr> 後藤大地  wrote
> hr>   in <459bd898-8072-426e-a968-96c1382ac...@icloud.com>:
> hr>
> hr> da>
> hr> da>
> hr> da> > 2018/07/02 15:55、Hiroki Sato のメール:
> hr> da> >
> hr> da> > Eitan Adler  wrote
> hr> da> >  in 
> :
> hr> da> >
> hr> da> > li> On 1 July 2018 at 10:08, Conrad Meyer  wrote:
> hr> da> > li> > Hi Daichi,
> hr> da> > li> >
> hr> da> > li> >
> hr> da> > li> >
> hr> da> > li> > I don't think code to decode UTF-8 belongs in top(1).  I 
> don't know
> hr> da> > li> > what the goal of this routine is, but I doubt this is the 
> right way to
> hr> da> > li> > accomplish it.
> hr> da> > li>
> hr> da> > li> For the record, I agree. This is why I didn't click "accept" on 
> the
> hr> da> > li> revision. I don't fully oppose leaving it in top(1) for now as 
> we work
> hr> da> > li> out the API, but long term its the wrong place.
> hr> da> > li>
> hr> da> > li> https://reviews.freebsd.org/D16058 is the review.
> hr> da> >
> hr> da> > I strongly object this kind of encoding-specific routine.  Please
> hr> da> > back out it.  The problem is that top(1) does not support multibyte
> hr> da> > encoding in functions for printing, and using C99 wide/multibyte
> hr> da> > character manipulation API such as iswprint(3) is the way to solve
> hr> da> > it.  Doing getenv("LANG") and assuming an encoding based on it is a
> hr> da> > very bad practice to internationalize software.
> hr> da> >
> hr> da> > -- Hiroki
> hr> da>
> hr> da> I respect what you mean.
> hr> da>
> hr> da> Once I back out, I will begin implementing it in a different way.
> hr> da> Please advise which function should be used for implementation
> hr> da> (iswprint (3) and what other functions should be used?)
> hr>
> hr>  Roughly speaking, POSIX/XPG/C99 I18N model requires the following
> hr>  steps:
> (snip)
> 
> Are you going to back out r335836, or disagree about it?
> 
> If there is no objection in the next 24 hours, I will commit the
> attached patch.  This should be a minimal change to support multibyte
> characters in ARGV array depending on LC_CTYPE, not limited to UTF-8.
> 
> -- Hiroki
> Index: usr.bin/top/display.c
> ===
> --- usr.bin/top/display.c (revision 335957)
> +++ usr.bin/top/display.c (working copy)
> @@ -1248,55 +1248,6 @@
> }
> }
> 
> -/*
> - *  printable(str) - make the string pointed to by "str" into one that is
> - *   printable (i.e.: all ascii), by converting all non-printable
> - *   characters into '?'.  Replacements are done in place and a pointer
> - *   to the original buffer is returned.
> - */
> -
> -char *
> -printable(char str[])
> -{
> - char *ptr;
> - char ch;
> -
> - ptr = str;
> - if (utf8flag) {
> - while ((ch = *ptr) != '\0') {
> - if (0x00 == (0x80 & ch)) {
> - if (!isprint(ch)) {
> - *ptr = '?';
> - }
> - ++ptr;
> - } else if (0xC0 == (0xE0 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else if (0xE0 == (0xF0 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else if (0xF0 == (0xF8 & ch)) {
> - ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - if ('\0' != *ptr) ++ptr;
> - } else {
> - *ptr = '?';
> - ++ptr;
> - }
> - }
> - } else {
> - while ((ch = *ptr) != '\0') {
> - if (!isprint(ch)) {
> - *ptr = '?';
> - }
> - ptr++;
> - }
> - }
> - return(str);
> -}
> -
> void
> i_uptime(struct timeval *bt, time_t *tod)
> {
> Index: usr.bin/top/display.h
> ===
> --- usr.bin/top/display.h (revision 335957)
> +++ usr.bin/top/display.h (working copy)
> @@ -11,7 +11,6 @@
> void   clear_message(void);
> intdisplay_resize(void);
> void   i_header(const char *text);
> -cha