threads / patch / 46851

patchgitk: expand $config_file_tmp before reporting to user

Subject: [PATCH] gitk: expand $config_file_tmp before reporting to user

## tl;dr

7 messages between Sep 28, 2017 and Sep 29, 2017. Diffs are folded; open one to read it.

replies: 6people: 4as markdown or json

Max Kirillov· Sep 28, 2017, 04:14 UTC · lore

Tilda-based path may confise some users. First, tilda is not known for Window users, second, it may point to unexpected location depending on various environment setup.

Expand the path to "nativename", so that ~/.config/git/gitk-tmp would be "C:\Users\user\.config\git\gitk-tmp", for example. It should be less cryptic

Signed-off-by: Max Kirillov <max@max630.net>
---
 gitk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to gitk +2 −1
diff --git a/gitk b/gitk
index 877d49e1de..48c1d3e714 100755
--- a/gitk
+++ b/gitk
@@ -2844,7 +2844,8 @@ proc config_check_tmp_exists {tries_left} {
 	if {$tries_left > 0} {
 	    after 100 [list config_check_tmp_exists $tries_left]
 	} else {
-	    error_popup "There appears to be a stale $config_file_tmp\
+	    error_popup "There appears to be a stale \
+ \"[file nativename $config_file_tmp]\" \
  file, which will prevent gitk from saving its configuration on exit.\
  Please remove it if it is not being used by any existing gitk process."
 	}
-- 
2.11.0.1122.gc3fec58.dirty
Junio C Hamano· Sep 28, 2017, 04:37 UTC · re: Max Kirillov · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

Max Kirillov <max@max630.net> writes:
Show 7 quoted lines
> Tilda-based path may confise some users. First, tilda is not known
> for Window users, second, it may point to unexpected location
> depending on various environment setup.
>
> Expand the path to "nativename", so that ~/.config/git/gitk-tmp
> would be "C:\Users\user\.config\git\gitk-tmp", for example.
> It should be less cryptic

It might be less cryptic, but for those of us whose $HOME is a looooooong path, ~/.config/git/gitk-tmp is much easier to understand than the same path with ~/ expanded, which would push the part of the filename that most matters far to the right hand side of the dialog.

I somehow find this change just robbing Peter to pay Paul.
>  	} else {
> -	    error_popup "There appears to be a stale $config_file_tmp\
> +	    error_popup "There appears to be a stale \
> + \"[file nativename $config_file_tmp]\" \
Junio C Hamano· Sep 28, 2017, 04:47 UTC · re: Junio C Hamano · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> Max Kirillov <max@max630.net> writes:
>
>> Tilda-based path may confise some users. First, tilda is not known
>> for Window users, second, it may point to unexpected location
>> depending on various environment setup.
>>
>> Expand the path to "nativename", so that ~/.config/git/gitk-tmp
>> would be "C:\Users\user\.config\git\gitk-tmp", for example.
>> It should be less cryptic
>
> It might be less cryptic, but for those of us whose $HOME is a
> looooooong path, ~/.config/git/gitk-tmp is much easier to understand
> than the same path with ~/ expanded, which would push the part of
> the filename that most matters far to the right hand side of the
> dialog.
>
> I somehow find this change just robbing Peter to pay Paul.

Having said that, because a set-up might have HOME or XDG_CONFIG or other things misconfigured to point at a place where the end user may not be expecting, I tend to think that catering to Paul by showing the information closer to the bare metal is much more worthy thing to do than keeping Peter happy. Since this is an error path, accuracy trumps convenience.

So no objection from me (unless somebody else comes up with an alternative that would make both camps happy, that is).

Thanks.
Johannes Schindelin· Sep 28, 2017, 12:31 UTC · re: Junio C Hamano · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

Hi Junio,
On Thu, 28 Sep 2017, Junio C Hamano wrote:
Show 11 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Max Kirillov <max@max630.net> writes:
> >
> >> Tilda-based path may confise some users. First, tilda is not known
> >> for Window users, second, it may point to unexpected location
> >> depending on various environment setup.
> >>
> >> Expand the path to "nativename", so that ~/.config/git/gitk-tmp
> >> would be "C:\Users\user\.config\git\gitk-tmp", for example.
> >> It should be less cryptic
Thanks, Max, for your contribution!
Show 5 quoted lines
> > It might be less cryptic, but for those of us whose $HOME is a
> > looooooong path, ~/.config/git/gitk-tmp is much easier to understand
> > than the same path with ~/ expanded, which would push the part of
> > the filename that most matters far to the right hand side of the
> > dialog.

Heh, do you want to know how that must sound to a Windows user? I'm not saying that I am a hard-core Windows user, but I do know a few, and I already hear their comments in their own voice in my head...

Show 11 quoted lines
> > I somehow find this change just robbing Peter to pay Paul.
> 
> Having said that, because a set-up might have HOME or XDG_CONFIG or
> other things misconfigured to point at a place where the end user
> may not be expecting, I tend to think that catering to Paul by
> showing the information closer to the bare metal is much more worthy
> thing to do than keeping Peter happy.  Since this is an error path,
> accuracy trumps convenience.
> 
> So no objection from me (unless somebody else comes up with an
> alternative that would make both camps happy, that is).

To Unix/Linux users, the tilde (or Tilda, I really like that nickname, it makes it much more human and tolerable) is probably *very* familiar.

As familiar, as it is unfamiliar to Windows users.

So I would actually suggest to make this a conditional on the platform: on Windows, use the native name, everywhere else, not.

Sound good? Johannes

Junio C Hamano· Sep 28, 2017, 22:03 UTC · re: Johannes Schindelin · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 12 quoted lines
>> > Max Kirillov <max@max630.net> writes:
>> >
>> >> Tilda-based path may confise some users. First, tilda is not known
>> >> for Window users, second, it may point to unexpected location
>> >> depending on various environment setup.
> ...
> As familiar, as it is unfamiliar to Windows users.
>
> So I would actually suggest to make this a conditional on the platform: on
> Windows, use the native name, everywhere else, not.
>
> Sound good?
Not really.  

I agree with and (more importantly) consider the second rationale Max cites a more relevant one for this change.

This is about reporting an error, and using the short-hand ~/$rest that could be pointing at a location different from what the user _thinks_ it points at for whatever reason (miconfigured HOME, some intermediate process setting it to something else, etc.) can hide the real issue. The problem can be more easily noticed and diagnosed if the message shows the result of 'nativename'.

And that rationale holds whether you are seeing the error message on Windows or non-Windows.

Max Kirillov· Sep 29, 2017, 04:34 UTC · re: Johannes Schindelin · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

On Thu, Sep 28, 2017 at 02:31:17PM +0200, Johannes Schindelin wrote:
Show 8 quoted lines
>>> Max Kirillov <max@max630.net> writes:
>>>> Tilda-based path may confise some users. First, tilda is not known
>>>> for Window users, second, it may point to unexpected location
>>>> depending on various environment setup.
>>>>
>>>> Expand the path to "nativename", so that ~/.config/git/gitk-tmp
>>>> would be "C:\Users\user\.config\git\gitk-tmp", for example.
>>>> It should be less cryptic
> Thanks, Max, for your contribution!

I do what I can. Just noticed s question at SO about it (https://stackoverflow.com/questions/46450479/how-to-remove-the-stale-gitk-tmp-file) Provided that I was author of the message, it looked like something for me to fix.

> Sound good?

As Junio noticed, it would be more reliable to show full path, and error message does not have to be very nice anyway. Also, gitk is already too big and I always feel bad when adding stuff to it, so let's save couple of lines by not adding another "if".

-- 
Max
Uxío Prego· Sep 29, 2017, 20:24 UTC · re: Junio C Hamano · lore

Re: [PATCH] gitk: expand $config_file_tmp before reporting to user

Well something like this is not paying _Paul_ enough for what he gave to The People, so I do not think there is worth trying.

Show 25 quoted lines
> On 28 Sep 2017, at 06:37, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Max Kirillov <max@max630.net> writes:
> 
>> Tilda-based path may confise some users. First, tilda is not known
>> for Window users, second, it may point to unexpected location
>> depending on various environment setup.
>> 
>> Expand the path to "nativename", so that ~/.config/git/gitk-tmp
>> would be "C:\Users\user\.config\git\gitk-tmp", for example.
>> It should be less cryptic
> 
> It might be less cryptic, but for those of us whose $HOME is a
> looooooong path, ~/.config/git/gitk-tmp is much easier to understand
> than the same path with ~/ expanded, which would push the part of
> the filename that most matters far to the right hand side of the
> dialog.
> 
> I somehow find this change just robbing Peter to pay Paul.
> 
>> 	} else {
>> -	    error_popup "There appears to be a stale $config_file_tmp\
>> +	    error_popup "There appears to be a stale \
>> + \"[file nativename $config_file_tmp]\" \
> 

← back to recent threads