git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Re: [PATCH] getpriority: Only getpriority translation the priority values
       [not found] <20220510220821.1481801-1-tbodt@google.com>
@ 2022-05-14 14:37 ` Alejandro Colomar
  2022-05-14 15:00   ` Alejandro Colomar
  2022-05-14 18:43   ` Martin Ågren
  0 siblings, 2 replies; 6+ messages in thread
From: Alejandro Colomar @ 2022-05-14 14:37 UTC (permalink / raw)
  To: Theodore Dubois; +Cc: linux-man, mtk.manpages, git

Hi Theodore,

On 5/11/22 00:08, Theodore Dubois wrote:
> The translation is needed to avoid returning a negative number from a
> successful syscall, and this requirement doesn't apply to setpriority.
> See the implementation of getpriority in kernel/sys.c.
> 
> Signed-off-by: Theodore Dubois <tbodt@google.com>

Patch applied.

BTW, I had to manually edit the patch.
It's the second time I see this (I can't find the other one), your patch 
didn't apply for the following reason: the a/ and b/ prefixes in the 
file paths are missing.  Did you use git-format-patch(1) to produce the 
patch?  Can you reproduce this?

I CCd the git mailing list in case they know what's going on.

Thanks,

Alex

> ---
>   man2/getpriority.2 | 17 ++++-------------
>   1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git man2/getpriority.2 man2/getpriority.2

Should have been:
diff --git a/man2/getpriority.2 b/man2/getpriority.2

> index 3e1be3e6c..24c1b7f11 100644
> --- man2/getpriority.2
> +++ man2/getpriority.2

Should have been:

--- a/man2/getpriority.2
+++ b/man2/getpriority.2


> @@ -206,20 +206,11 @@ All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
>   manner as Linux 2.6.12 and later.
>   .\"
>   .SS C library/kernel differences
> -Within the kernel, nice values are actually represented
> -using the range 40..1
> -(since negative numbers are error codes) and these are the values
> -employed by the
> -.BR setpriority ()
> -and
> -.BR getpriority ()
> -system calls.
> -The glibc wrapper functions for these system calls handle the
> -translations between the user-land and kernel representations
> -of the nice value according to the formula
> +The getpriority system call returns nice values translated to the range 40..1,
> +since a negative return value would be interpreted as an error.
> +The glibc wrapper function for getpriority translates the value back according to the formula
>   .IR "unice\ =\ 20\ \-\ knice" .
> -(Thus, the kernel's 40..1 range corresponds to the
> -range \-20..19 as seen by user space.)
> +(Thus, the 40..1 range returned by the kernel corresponds to the range \-20..19 as seen by user space.)
>   .SH BUGS
>   According to POSIX, the nice value is a per-process setting.
>   However, under the current Linux/NPTL implementation of POSIX threads,

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

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

* Re: [PATCH] getpriority: Only getpriority translation the priority values
  2022-05-14 14:37 ` [PATCH] getpriority: Only getpriority translation the priority values Alejandro Colomar
@ 2022-05-14 15:00   ` Alejandro Colomar
  2022-05-14 18:43   ` Martin Ågren
  1 sibling, 0 replies; 6+ messages in thread
From: Alejandro Colomar @ 2022-05-14 15:00 UTC (permalink / raw)
  To: Theodore Dubois; +Cc: linux-man, mtk.manpages, git, nick black

[CC += nick]

On 5/14/22 16:37, Alejandro Colomar wrote:
> Hi Theodore,
> 
> On 5/11/22 00:08, Theodore Dubois wrote:
>> The translation is needed to avoid returning a negative number from a
>> successful syscall, and this requirement doesn't apply to setpriority.
>> See the implementation of getpriority in kernel/sys.c.
>>
>> Signed-off-by: Theodore Dubois <tbodt@google.com>
> 
> Patch applied.
> 
> BTW, I had to manually edit the patch.
> It's the second time I see this (I can't find the other one), your patch 

The other one:

<https://lore.kernel.org/linux-man/809c40c4-068b-8296-57d9-024e6623362d@gmail.com/T/#u>

nick, I finally found it again!

> didn't apply for the following reason: the a/ and b/ prefixes in the 
> file paths are missing.  Did you use git-format-patch(1) to produce the 
> patch?  Can you reproduce this?
> 
> I CCd the git mailing list in case they know what's going on.
> 
> Thanks,
> 
> Alex
> 
>> ---
>>   man2/getpriority.2 | 17 ++++-------------
>>   1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git man2/getpriority.2 man2/getpriority.2
> 
> Should have been:
> diff --git a/man2/getpriority.2 b/man2/getpriority.2
> 
>> index 3e1be3e6c..24c1b7f11 100644
>> --- man2/getpriority.2
>> +++ man2/getpriority.2
> 
> Should have been:
> 
> --- a/man2/getpriority.2
> +++ b/man2/getpriority.2
> 
> 
>> @@ -206,20 +206,11 @@ All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
>>   manner as Linux 2.6.12 and later.
>>   .\"
>>   .SS C library/kernel differences
>> -Within the kernel, nice values are actually represented
>> -using the range 40..1
>> -(since negative numbers are error codes) and these are the values
>> -employed by the
>> -.BR setpriority ()
>> -and
>> -.BR getpriority ()
>> -system calls.
>> -The glibc wrapper functions for these system calls handle the
>> -translations between the user-land and kernel representations
>> -of the nice value according to the formula
>> +The getpriority system call returns nice values translated to the 
>> range 40..1,
>> +since a negative return value would be interpreted as an error.
>> +The glibc wrapper function for getpriority translates the value back 
>> according to the formula
>>   .IR "unice\ =\ 20\ \-\ knice" .
>> -(Thus, the kernel's 40..1 range corresponds to the
>> -range \-20..19 as seen by user space.)
>> +(Thus, the 40..1 range returned by the kernel corresponds to the 
>> range \-20..19 as seen by user space.)
>>   .SH BUGS
>>   According to POSIX, the nice value is a per-process setting.
>>   However, under the current Linux/NPTL implementation of POSIX threads,
> 

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

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

* Re: [PATCH] getpriority: Only getpriority translation the priority values
  2022-05-14 14:37 ` [PATCH] getpriority: Only getpriority translation the priority values Alejandro Colomar
  2022-05-14 15:00   ` Alejandro Colomar
@ 2022-05-14 18:43   ` Martin Ågren
  2022-05-14 21:18     ` Alejandro Colomar
  2022-05-17 17:02     ` Theodore Dubois
  1 sibling, 2 replies; 6+ messages in thread
From: Martin Ågren @ 2022-05-14 18:43 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: Theodore Dubois, linux-man, mtk.manpages, Git Mailing List

On Sat, 14 May 2022 at 17:11, Alejandro Colomar <alx.manpages@gmail.com> wrote:
>
> BTW, I had to manually edit the patch.
> It's the second time I see this (I can't find the other one), your patch
> didn't apply for the following reason: the a/ and b/ prefixes in the
> file paths are missing.  Did you use git-format-patch(1) to produce the
> patch?  Can you reproduce this?
>
> I CCd the git mailing list in case they know what's going on.

Sounds like `git format-patch --no-prefix` at play. Or more likely, that
the `diff.noprefix` config is on. I don't think it can be cancelled out
by a `--no-no-prefix`, unfortunately. If a script is involved in running
`git format-patch`, maybe it's not too tedious to make it do

  git -c diff.noprefix=no format-patch ...

to cancel the config. (If that config really does want to be on, that
is.)

That said, something like

  git am -p0 ...

should help on the receiving side, by way of skipping fewer path
components when applying the patch.

Martin

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

* Re: [PATCH] getpriority: Only getpriority translation the priority values
  2022-05-14 18:43   ` Martin Ågren
@ 2022-05-14 21:18     ` Alejandro Colomar
  2022-05-17 17:02     ` Theodore Dubois
  1 sibling, 0 replies; 6+ messages in thread
From: Alejandro Colomar @ 2022-05-14 21:18 UTC (permalink / raw)
  To: Martin Ågren
  Cc: Theodore Dubois, linux-man, mtk.manpages, Git Mailing List

Hi Martin,

On 5/14/22 20:43, Martin Ågren wrote:
> That said, something like
> 
>    git am -p0 ...
> 
> should help on the receiving side, by way of skipping fewer path
> components when applying the patch.

That works for me.
Thanks!

Alex

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

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

* Re: [PATCH] getpriority: Only getpriority translation the priority values
  2022-05-14 18:43   ` Martin Ågren
  2022-05-14 21:18     ` Alejandro Colomar
@ 2022-05-17 17:02     ` Theodore Dubois
  2022-05-18 17:21       ` Perhaps we want {diff,log,format}.noprefix and friends? Junio C Hamano
  1 sibling, 1 reply; 6+ messages in thread
From: Theodore Dubois @ 2022-05-17 17:02 UTC (permalink / raw)
  To: Martin Ågren
  Cc: Alejandro Colomar, linux-man, mtk.manpages, Git Mailing List

Yep, I have diff.noprefix on.

~Theodore

On Sat, May 14, 2022 at 11:43 AM Martin Ågren <martin.agren@gmail.com> wrote:
>
> On Sat, 14 May 2022 at 17:11, Alejandro Colomar <alx.manpages@gmail.com> wrote:
> >
> > BTW, I had to manually edit the patch.
> > It's the second time I see this (I can't find the other one), your patch
> > didn't apply for the following reason: the a/ and b/ prefixes in the
> > file paths are missing.  Did you use git-format-patch(1) to produce the
> > patch?  Can you reproduce this?
> >
> > I CCd the git mailing list in case they know what's going on.
>
> Sounds like `git format-patch --no-prefix` at play. Or more likely, that
> the `diff.noprefix` config is on. I don't think it can be cancelled out
> by a `--no-no-prefix`, unfortunately. If a script is involved in running
> `git format-patch`, maybe it's not too tedious to make it do
>
>   git -c diff.noprefix=no format-patch ...
>
> to cancel the config. (If that config really does want to be on, that
> is.)
>
> That said, something like
>
>   git am -p0 ...
>
> should help on the receiving side, by way of skipping fewer path
> components when applying the patch.
>
> Martin

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

* Perhaps we want {diff,log,format}.noprefix and friends?
  2022-05-17 17:02     ` Theodore Dubois
@ 2022-05-18 17:21       ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2022-05-18 17:21 UTC (permalink / raw)
  To: git

>>   git -c diff.noprefix=no format-patch ...
>>
>> to cancel the config. (If that config really does want to be on, that
>> is.)
>>
>> That said, something like
>>
>>   git am -p0 ...
>>
>> should help on the receiving side, by way of skipping fewer path
>> components when applying the patch.

While it is very reasonable for end-users to make the output of
their local "git diff" output to their taste by setting the
diff.noprefix and other configuration options in the diff.*
namespace, it is wrong to inflict such a personal preference on
other project participants by sending such a no-prefix patch via
"git format-patch", when the convention at the receiving project is
to use "git am -p1" to accept them.

We would need to tweak the configuration system so that we can more
easily introduce "format.noprefix" that overrides "diff.noprefix"
only when the command being run is "git format-patch", perhaps?  

As things stand, we could teach builtin/log.c::git_format_config()
about "format.noprefix" and make "git format-patch" pay attention to
that in addition to "diff.noprefix" fairly easily, but such an
approach poorly scales.  When a new configuration gets introduced in
diff.c::git_diff_ui_config(), builtin/log.c::git_format_config()
would also need to be updated.

I initially started writing this with "left over bits" mark, but it
seems it is a bit larger in scope than that.

I also noticed that some format.* configuration variables are parsed
in git_log_config(), not git_format_config(), so "git log" would end
up honoring format.pretty and format.subjectprefix, etc., which look
wrong but probably is way too late to "fix".



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

end of thread, other threads:[~2022-05-18 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220510220821.1481801-1-tbodt@google.com>
2022-05-14 14:37 ` [PATCH] getpriority: Only getpriority translation the priority values Alejandro Colomar
2022-05-14 15:00   ` Alejandro Colomar
2022-05-14 18:43   ` Martin Ågren
2022-05-14 21:18     ` Alejandro Colomar
2022-05-17 17:02     ` Theodore Dubois
2022-05-18 17:21       ` Perhaps we want {diff,log,format}.noprefix and friends? Junio C Hamano

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).