public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
@ 2022-11-03 17:04 Jon Turney
  2022-11-03 18:22 ` Jeremy Drake
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Turney @ 2022-11-03 17:04 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Jon Turney

gdb supports 'set disable-randomization off' on Windows since [1]
(included in gdb 13).

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
---
 winsup/doc/faq-programming.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
index 7945b6b88..41cd5e423 100644
--- a/winsup/doc/faq-programming.xml
+++ b/winsup/doc/faq-programming.xml
@@ -844,6 +844,12 @@ Guide here: <ulink url="https://cygwin.com/cygwin-ug-net/dll.html"/>.
   Note that the DllMain entrypoints for linked DLLs will have been executed
   before this breakpoint is hit.
 </para>
+
+<para>
+  (It may be necessary to use the <command>gdb</command> command <command>set
+  disable-randomization off</command> to turn off ASLR for the debugee to
+  prevent the base address getting randomized.)
+</para>
 </answer></qandaentry>
 
 <qandaentry id="faq.programming.debug">
-- 
2.38.1


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-03 17:04 [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR Jon Turney
@ 2022-11-03 18:22 ` Jeremy Drake
  2022-11-04 10:34   ` Corinna Vinschen
  0 siblings, 1 reply; 15+ messages in thread
From: Jeremy Drake @ 2022-11-03 18:22 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-patches

On Thu, 3 Nov 2022, Jon Turney wrote:

> gdb supports 'set disable-randomization off' on Windows since [1]
> (included in gdb 13).
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008

Is it really *disable*-randomization *off*?  The double-negative seems to
suggest that in that case ASLR would be left *on*.

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-03 18:22 ` Jeremy Drake
@ 2022-11-04 10:34   ` Corinna Vinschen
  2022-11-04 12:53     ` Jon Turney
  0 siblings, 1 reply; 15+ messages in thread
From: Corinna Vinschen @ 2022-11-04 10:34 UTC (permalink / raw)
  To: cygwin-patches

On Nov  3 11:22, Jeremy Drake via Cygwin-patches wrote:
> On Thu, 3 Nov 2022, Jon Turney wrote:
> 
> > gdb supports 'set disable-randomization off' on Windows since [1]
> > (included in gdb 13).
> >
> > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
> 
> Is it really *disable*-randomization *off*?  The double-negative seems to
> suggest that in that case ASLR would be left *on*.

Yeah, sounds weird....


Corinna

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-04 10:34   ` Corinna Vinschen
@ 2022-11-04 12:53     ` Jon Turney
  2022-11-04 13:16       ` Corinna Vinschen
  2022-11-04 15:29       ` Pedro Alves
  0 siblings, 2 replies; 15+ messages in thread
From: Jon Turney @ 2022-11-04 12:53 UTC (permalink / raw)
  To: Cygwin Patches

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

On 04/11/2022 10:34, Corinna Vinschen wrote:
> On Nov  3 11:22, Jeremy Drake via Cygwin-patches wrote:
>> On Thu, 3 Nov 2022, Jon Turney wrote:
>>
>>> gdb supports 'set disable-randomization off' on Windows since [1]
>>> (included in gdb 13).
>>>
>>> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
>>
>> Is it really *disable*-randomization *off*?  The double-negative seems to
>> suggest that in that case ASLR would be left *on*.
> 
> Yeah, sounds weird....

Yes, this is just stupidity.  Revised patch attached.

[-- Attachment #2: 0001-Cygwin-Improve-FAQ-on-early-breakpoint-for-ASLR.patch --]
[-- Type: text/plain, Size: 1239 bytes --]

From 9ffce0d6124933cf16aee3ad006e32858fe0754a Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Tue, 1 Nov 2022 16:52:57 +0000
Subject: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR

gdb supports the 'disable-randomization' setting on Windows since [1]
(included in gdb 13).

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
---
 winsup/doc/faq-programming.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
index 7945b6b88..36d0a401f 100644
--- a/winsup/doc/faq-programming.xml
+++ b/winsup/doc/faq-programming.xml
@@ -844,6 +844,12 @@ Guide here: <ulink url="https://cygwin.com/cygwin-ug-net/dll.html"/>.
   Note that the DllMain entrypoints for linked DLLs will have been executed
   before this breakpoint is hit.
 </para>
+
+<para>
+  (It may be necessary to use the <command>gdb</command> command <command>set
+  disable-randomization on</command> to turn off ASLR for the debugee to
+  prevent the base address getting randomized.)
+</para>
 </answer></qandaentry>
 
 <qandaentry id="faq.programming.debug">
-- 
2.38.1


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-04 12:53     ` Jon Turney
@ 2022-11-04 13:16       ` Corinna Vinschen
  2022-11-04 15:29       ` Pedro Alves
  1 sibling, 0 replies; 15+ messages in thread
From: Corinna Vinschen @ 2022-11-04 13:16 UTC (permalink / raw)
  To: cygwin-patches

On Nov  4 12:53, Jon Turney wrote:
> On 04/11/2022 10:34, Corinna Vinschen wrote:
> > On Nov  3 11:22, Jeremy Drake via Cygwin-patches wrote:
> > > On Thu, 3 Nov 2022, Jon Turney wrote:
> > > 
> > > > gdb supports 'set disable-randomization off' on Windows since [1]
> > > > (included in gdb 13).
> > > > 
> > > > https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
> > > 
> > > Is it really *disable*-randomization *off*?  The double-negative seems to
> > > suggest that in that case ASLR would be left *on*.
> > 
> > Yeah, sounds weird....
> 
> Yes, this is just stupidity.  Revised patch attached.

Heh, please push.


Thanks,
Corinna

> From 9ffce0d6124933cf16aee3ad006e32858fe0754a Mon Sep 17 00:00:00 2001
> From: Jon Turney <jon.turney@dronecode.org.uk>
> Date: Tue, 1 Nov 2022 16:52:57 +0000
> Subject: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
> 
> gdb supports the 'disable-randomization' setting on Windows since [1]
> (included in gdb 13).
> 
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bcb9251f029da8dcf360a4f5acfa3b4211c87bb0;hp=8fea1a81c7d9279a6f91e49ebacfb61e0f8ce008
> ---
>  winsup/doc/faq-programming.xml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
> index 7945b6b88..36d0a401f 100644
> --- a/winsup/doc/faq-programming.xml
> +++ b/winsup/doc/faq-programming.xml
> @@ -844,6 +844,12 @@ Guide here: <ulink url="https://cygwin.com/cygwin-ug-net/dll.html"/>.
>    Note that the DllMain entrypoints for linked DLLs will have been executed
>    before this breakpoint is hit.
>  </para>
> +
> +<para>
> +  (It may be necessary to use the <command>gdb</command> command <command>set
> +  disable-randomization on</command> to turn off ASLR for the debugee to
> +  prevent the base address getting randomized.)
> +</para>
>  </answer></qandaentry>
>  
>  <qandaentry id="faq.programming.debug">
> -- 
> 2.38.1
> 


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-04 12:53     ` Jon Turney
  2022-11-04 13:16       ` Corinna Vinschen
@ 2022-11-04 15:29       ` Pedro Alves
  2022-11-12 14:30         ` Jon Turney
  1 sibling, 1 reply; 15+ messages in thread
From: Pedro Alves @ 2022-11-04 15:29 UTC (permalink / raw)
  To: Jon Turney, Cygwin Patches; +Cc: pedro

On 2022-11-04 12:53 p.m., Jon Turney wrote:
> +<para>
> +  (It may be necessary to use the <command>gdb</command> command <command>set
> +  disable-randomization on</command> to turn off ASLR for the debugee to
> +  prevent the base address getting randomized.)
> +</para>
>  </answer></qandaentry>
>  

Typo: debugee -> debuggee

Note that "on" is the default.

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-04 15:29       ` Pedro Alves
@ 2022-11-12 14:30         ` Jon Turney
  2022-11-15 10:46           ` Corinna Vinschen
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Turney @ 2022-11-12 14:30 UTC (permalink / raw)
  To: Cygwin Patches

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

On 04/11/2022 15:29, Pedro Alves wrote:
> On 2022-11-04 12:53 p.m., Jon Turney wrote:
>> +<para>
>> +  (It may be necessary to use the <command>gdb</command> command <command>set
>> +  disable-randomization on</command> to turn off ASLR for the debugee to
>> +  prevent the base address getting randomized.)
>> +</para>
>>   </answer></qandaentry>
>>   
> 
> Typo: debugee -> debuggee

Thanks for catching that.

Patch attached.

> Note that "on" is the default.

True.  But the API used by gdb to turn off ASLR isn't supported by some 
versions of Windows.

This sentence could be a lot more explicit about all the details here, 
but I'm just trying to be brief.

[-- Attachment #2: 0001-Cygwin-Fix-typo-in-FAQ.patch --]
[-- Type: text/plain, Size: 992 bytes --]

From be24c9b69e72648690a477fd2f15b0a9c6374713 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat, 12 Nov 2022 14:16:36 +0000
Subject: [PATCH] Cygwin: Fix typo in FAQ

The consonant in 'debug' is doubled in 'debuggee' just as it is in
'debugger'.

Fixes: 8c68a8a4
---
 winsup/doc/faq-programming.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
index 36d0a401f..89c309af2 100644
--- a/winsup/doc/faq-programming.xml
+++ b/winsup/doc/faq-programming.xml
@@ -847,7 +847,7 @@ Guide here: <ulink url="https://cygwin.com/cygwin-ug-net/dll.html"/>.
 
 <para>
   (It may be necessary to use the <command>gdb</command> command <command>set
-  disable-randomization on</command> to turn off ASLR for the debugee to
+  disable-randomization on</command> to turn off ASLR for the debuggee to
   prevent the base address getting randomized.)
 </para>
 </answer></qandaentry>
-- 
2.38.1


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-12 14:30         ` Jon Turney
@ 2022-11-15 10:46           ` Corinna Vinschen
  2022-11-28 13:00             ` Jon Turney
  0 siblings, 1 reply; 15+ messages in thread
From: Corinna Vinschen @ 2022-11-15 10:46 UTC (permalink / raw)
  To: cygwin-patches

Hi Jon,

the patch is fine, but...

On Nov 12 14:30, Jon Turney wrote:
> On 04/11/2022 15:29, Pedro Alves wrote:
> > On 2022-11-04 12:53 p.m., Jon Turney wrote:
> > > +<para>
> > > +  (It may be necessary to use the <command>gdb</command> command <command>set
> > > +  disable-randomization on</command> to turn off ASLR for the debugee to
> > > +  prevent the base address getting randomized.)
> > > +</para>
> > >   </answer></qandaentry>
> > 
> > Typo: debugee -> debuggee
> 
> Thanks for catching that.
> 
> Patch attached.
> 
> > Note that "on" is the default.
> 
> True.  But the API used by gdb to turn off ASLR isn't supported by some
> versions of Windows.
> 
> This sentence could be a lot more explicit about all the details here, but
> I'm just trying to be brief.

> From be24c9b69e72648690a477fd2f15b0a9c6374713 Mon Sep 17 00:00:00 2001
> From: Jon Turney <jon.turney@dronecode.org.uk>
> Date: Sat, 12 Nov 2022 14:16:36 +0000
> Subject: [PATCH] Cygwin: Fix typo in FAQ
> 
> The consonant in 'debug' is doubled in 'debuggee' just as it is in
> 'debugger'.
> 
> Fixes: 8c68a8a4

It would be great if we could get used to using the same syntax as the
Linux kernel project to document stuff.  I'm trying to follow their lead
for a while.  For fixes to former commits, it looks like this in the
kernel, at the end of the commit message:

Fixes: 123456789012 ("title of commit 123456789012")

Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
time locally.

Anyway, please push.


Thanks,
Corinna

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-15 10:46           ` Corinna Vinschen
@ 2022-11-28 13:00             ` Jon Turney
  2022-11-28 14:41               ` Corinna Vinschen
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Turney @ 2022-11-28 13:00 UTC (permalink / raw)
  To: Cygwin Patches

On 15/11/2022 10:46, Corinna Vinschen wrote:
> 
> It would be great if we could get used to using the same syntax as the
> Linux kernel project to document stuff.  I'm trying to follow their lead
> for a while.  For fixes to former commits, it looks like this in the
> kernel, at the end of the commit message:
> 
> Fixes: 123456789012 ("title of commit 123456789012")
> 
> Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
> time locally.

Sounds good.  Is there some script to automate generating this kind of 
comment from a commit-id?

> Anyway, please push.

Thanks


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-28 13:00             ` Jon Turney
@ 2022-11-28 14:41               ` Corinna Vinschen
  2022-12-05 15:23                 ` Johannes Schindelin
  0 siblings, 1 reply; 15+ messages in thread
From: Corinna Vinschen @ 2022-11-28 14:41 UTC (permalink / raw)
  To: cygwin-patches

On Nov 28 13:00, Jon Turney wrote:
> On 15/11/2022 10:46, Corinna Vinschen wrote:
> > 
> > It would be great if we could get used to using the same syntax as the
> > Linux kernel project to document stuff.  I'm trying to follow their lead
> > for a while.  For fixes to former commits, it looks like this in the
> > kernel, at the end of the commit message:
> > 
> > Fixes: 123456789012 ("title of commit 123456789012")
> > 
> > Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
> > time locally.
> 
> Sounds good.  Is there some script to automate generating this kind of
> comment from a commit-id?

I don't think so, at least I don't see anything like that in git docs...


Corinna

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-11-28 14:41               ` Corinna Vinschen
@ 2022-12-05 15:23                 ` Johannes Schindelin
  2022-12-11 13:54                   ` Jon Turney
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Schindelin @ 2022-12-05 15:23 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: cygwin-patches

Hi,

On Mon, 28 Nov 2022, Corinna Vinschen wrote:

> On Nov 28 13:00, Jon Turney wrote:
> > On 15/11/2022 10:46, Corinna Vinschen wrote:
> > >
> > > It would be great if we could get used to using the same syntax as the
> > > Linux kernel project to document stuff.  I'm trying to follow their lead
> > > for a while.  For fixes to former commits, it looks like this in the
> > > kernel, at the end of the commit message:
> > >
> > > Fixes: 123456789012 ("title of commit 123456789012")
> > >
> > > Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
> > > time locally.
> >
> > Sounds good.  Is there some script to automate generating this kind of
> > comment from a commit-id?
>
> I don't think so, at least I don't see anything like that in git docs...

It's note _quite_ what you asked for, but `git show --pretty=reference -s
<commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you
_almost_ what you are looking for.

But you can always call `git show -s --format='%h ("%s")' <commit>`, and
even configure an alias for this:

	git config --global alias.pretty-print-commit \
		"-c core.abbrev=12 show -s --format='%h (\"%s\")'"

Ciao,
Johannes

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-12-05 15:23                 ` Johannes Schindelin
@ 2022-12-11 13:54                   ` Jon Turney
  2022-12-11 14:45                     ` Johannes Schindelin
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Turney @ 2022-12-11 13:54 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: cygwin-patches

On 05/12/2022 15:23, Johannes Schindelin wrote:
> On Mon, 28 Nov 2022, Corinna Vinschen wrote:
>> On Nov 28 13:00, Jon Turney wrote:
>>> On 15/11/2022 10:46, Corinna Vinschen wrote:
>>>>
>>>> It would be great if we could get used to using the same syntax as the
>>>> Linux kernel project to document stuff.  I'm trying to follow their lead
>>>> for a while.  For fixes to former commits, it looks like this in the
>>>> kernel, at the end of the commit message:
>>>>
>>>> Fixes: 123456789012 ("title of commit 123456789012")
>>>>
>>>> Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
>>>> time locally.
>>>
>>> Sounds good.  Is there some script to automate generating this kind of
>>> comment from a commit-id?
>>
>> I don't think so, at least I don't see anything like that in git docs...
> 
> It's note _quite_ what you asked for, but `git show --pretty=reference -s
> <commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you
> _almost_ what you are looking for.
> 
> But you can always call `git show -s --format='%h ("%s")' <commit>`, and
> even configure an alias for this:
> 
> 	git config --global alias.pretty-print-commit \
> 		"-c core.abbrev=12 show -s --format='%h (\"%s\")'"
> 
Thanks!

I added '-c core.pager=', but this is what I was looking for, to save a 
bit of copying and pasting and editing.


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-12-11 13:54                   ` Jon Turney
@ 2022-12-11 14:45                     ` Johannes Schindelin
  2022-12-14 17:37                       ` Jon Turney
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Schindelin @ 2022-12-11 14:45 UTC (permalink / raw)
  To: Jon Turney; +Cc: cygwin-patches

On December 11, 2022 2:54:02 PM GMT+01:00, Jon Turney <jon.turney@dronecode.org.uk> wrote:
>On 05/12/2022 15:23, Johannes Schindelin wrote:
>> On Mon, 28 Nov 2022, Corinna Vinschen wrote:
>>> On Nov 28 13:00, Jon Turney wrote:
>>>> On 15/11/2022 10:46, Corinna Vinschen wrote:
>>>>>
>>>>> It would be great if we could get used to using the same syntax as the
>>>>> Linux kernel project to document stuff.  I'm trying to follow their lead
>>>>> for a while.  For fixes to former commits, it looks like this in the
>>>>> kernel, at the end of the commit message:
>>>>>
>>>>> Fixes: 123456789012 ("title of commit 123456789012")
>>>>>
>>>>> Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
>>>>> time locally.
>>>>
>>>> Sounds good.  Is there some script to automate generating this kind of
>>>> comment from a commit-id?
>>>
>>> I don't think so, at least I don't see anything like that in git docs...
>> 
>> It's note _quite_ what you asked for, but `git show --pretty=reference -s
>> <commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you
>> _almost_ what you are looking for.
>> 
>> But you can always call `git show -s --format='%h ("%s")' <commit>`, and
>> even configure an alias for this:
>> 
>> 	git config --global alias.pretty-print-commit \
>> 		"-c core.abbrev=12 show -s --format='%h (\"%s\")'"
>> 
>Thanks!
>
>I added '-c core.pager=', but this is what I was looking for, to save a 
>bit of copying and pasting and editing.
>

Better use `git -P`, then... (see https://git-scm.com/docs/git#Documentation/git.txt--P for full details)

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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-12-11 14:45                     ` Johannes Schindelin
@ 2022-12-14 17:37                       ` Jon Turney
  2023-03-28  8:26                         ` Johannes Schindelin
  0 siblings, 1 reply; 15+ messages in thread
From: Jon Turney @ 2022-12-14 17:37 UTC (permalink / raw)
  To: Johannes Schindelin, Cygwin Patches

On 11/12/2022 14:45, Johannes Schindelin wrote:
> On December 11, 2022 2:54:02 PM GMT+01:00, Jon Turney <jon.turney@dronecode.org.uk> wrote:
>> On 05/12/2022 15:23, Johannes Schindelin wrote:
>>> On Mon, 28 Nov 2022, Corinna Vinschen wrote:
>>>> On Nov 28 13:00, Jon Turney wrote:
>>>>> On 15/11/2022 10:46, Corinna Vinschen wrote:
>>>>>>
>>>>>> It would be great if we could get used to using the same syntax as the
>>>>>> Linux kernel project to document stuff.  I'm trying to follow their lead
>>>>>> for a while.  For fixes to former commits, it looks like this in the
>>>>>> kernel, at the end of the commit message:
>>>>>>
>>>>>> Fixes: 123456789012 ("title of commit 123456789012")
>>>>>>
>>>>>> Yeah, core.abbrev is 12 digits.  I'm using this setting for quite some
>>>>>> time locally.
>>>>>
>>>>> Sounds good.  Is there some script to automate generating this kind of
>>>>> comment from a commit-id?
>>>>
>>>> I don't think so, at least I don't see anything like that in git docs...
>>>
>>> It's note _quite_ what you asked for, but `git show --pretty=reference -s
>>> <commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you
>>> _almost_ what you are looking for.
>>>
>>> But you can always call `git show -s --format='%h ("%s")' <commit>`, and
>>> even configure an alias for this:
>>>
>>> 	git config --global alias.pretty-print-commit \
>>> 		"-c core.abbrev=12 show -s --format='%h (\"%s\")'"
>>>
>> Thanks!
>>
>> I added '-c core.pager=', but this is what I was looking for, to save a
>> bit of copying and pasting and editing.
>>
> 
> Better use `git -P`, then... (see https://git-scm.com/docs/git#Documentation/git.txt--P for full details)
> 

I started off with that, but that fails when used with:

fatal: alias 'pretty-print-commit' changes environment variables.
You can use '!git' in the alias to do this

... which I'm sure tells me the right way to write this :)


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

* Re: [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR
  2022-12-14 17:37                       ` Jon Turney
@ 2023-03-28  8:26                         ` Johannes Schindelin
  0 siblings, 0 replies; 15+ messages in thread
From: Johannes Schindelin @ 2023-03-28  8:26 UTC (permalink / raw)
  To: Jon Turney; +Cc: Cygwin Patches

Hi Jon,

On Wed, 14 Dec 2022, Jon Turney wrote:

> On 11/12/2022 14:45, Johannes Schindelin wrote:
> > On December 11, 2022 2:54:02 PM GMT+01:00, Jon Turney
> > <jon.turney@dronecode.org.uk> wrote:
> > > On 05/12/2022 15:23, Johannes Schindelin wrote:
> > > > On Mon, 28 Nov 2022, Corinna Vinschen wrote:
> > > > > On Nov 28 13:00, Jon Turney wrote:
> > > > > > On 15/11/2022 10:46, Corinna Vinschen wrote:
> > > > > > >
> > > > > > > It would be great if we could get used to using the same syntax as
> > > > > > > the
> > > > > > > Linux kernel project to document stuff.  I'm trying to follow
> > > > > > > their lead
> > > > > > > for a while.  For fixes to former commits, it looks like this in
> > > > > > > the
> > > > > > > kernel, at the end of the commit message:
> > > > > > >
> > > > > > > Fixes: 123456789012 ("title of commit 123456789012")
> > > > > > >
> > > > > > > Yeah, core.abbrev is 12 digits.  I'm using this setting for quite
> > > > > > > some
> > > > > > > time locally.
> > > > > >
> > > > > > Sounds good.  Is there some script to automate generating this kind
> > > > > > of
> > > > > > comment from a commit-id?
> > > > >
> > > > > I don't think so, at least I don't see anything like that in git
> > > > > docs...
> > > >
> > > > It's note _quite_ what you asked for, but `git show --pretty=reference
> > > > -s
> > > > <commit>` (https://git-scm.com/docs/git-show#_pretty_formats) gives you
> > > > _almost_ what you are looking for.
> > > >
> > > > But you can always call `git show -s --format='%h ("%s")' <commit>`, and
> > > > even configure an alias for this:
> > > >
> > > >  git config --global alias.pretty-print-commit \
> > > >   "-c core.abbrev=12 show -s --format='%h (\"%s\")'"
> > > >
> > > Thanks!
> > >
> > > I added '-c core.pager=', but this is what I was looking for, to save a
> > > bit of copying and pasting and editing.
> > >
> >
> > Better use `git -P`, then... (see
> > https://git-scm.com/docs/git#Documentation/git.txt--P for full details)
> >
>
> I started off with that, but that fails when used with:
>
> fatal: alias 'pretty-print-commit' changes environment variables.
> You can use '!git' in the alias to do this
>
> ... which I'm sure tells me the right way to write this :)

My apologies for leading you on this windy path through Git's obscure and
intricate internals.

The problem is that the `-P` option claims to change the environment (see
https://github.com/git/git/blob/v2.40.0/git.c#L176-L179), and aliases are
not allowed to do that.

You _can_ work around that by using `!git -P [...]`, i.e. by forcing a
shell to be spawned that then spawns `git`. But that is wasteful,
especially given the performance characteristics of spawning processes in
Cygwin.

Therefore, your `-c core.pager=` solution is much preferable to my
suggestion to use `-P`.

Ciao,
Johannes

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

end of thread, other threads:[~2023-03-28  8:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 17:04 [PATCH] Cygwin: Improve FAQ on early breakpoint for ASLR Jon Turney
2022-11-03 18:22 ` Jeremy Drake
2022-11-04 10:34   ` Corinna Vinschen
2022-11-04 12:53     ` Jon Turney
2022-11-04 13:16       ` Corinna Vinschen
2022-11-04 15:29       ` Pedro Alves
2022-11-12 14:30         ` Jon Turney
2022-11-15 10:46           ` Corinna Vinschen
2022-11-28 13:00             ` Jon Turney
2022-11-28 14:41               ` Corinna Vinschen
2022-12-05 15:23                 ` Johannes Schindelin
2022-12-11 13:54                   ` Jon Turney
2022-12-11 14:45                     ` Johannes Schindelin
2022-12-14 17:37                       ` Jon Turney
2023-03-28  8:26                         ` Johannes Schindelin

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).