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

7 messages from 2017-09-28 to 2017-09-29. Participants: Max Kirillov, Junio C Hamano, Johannes Schindelin, Uxío Prego.
Thread: https://gitlist.dev/t/46851

## Max Kirillov, 2017-09-28 04:14

Subject: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <20170928041417.28947-1-max@max630.net>
URL: https://gitlist.dev/e/20170928041417.28947-1-max%40max630.net

```
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(-)

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, 2017-09-28 04:37

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <xmqq4lrn30bz.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq4lrn30bz.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170928041417.28947-1-max@max630.net>

```
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]\" \


```

## Junio C Hamano, 2017-09-28 04:47

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <xmqqzi9f1lb2.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqzi9f1lb2.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <xmqq4lrn30bz.fsf@gitster.mtv.corp.google.com>

```
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
>
> 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, 2017-09-28 12:31

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <alpine.DEB.2.21.1.1709281428170.40514@virtualbox>
URL: https://gitlist.dev/e/alpine.DEB.2.21.1.1709281428170.40514%40virtualbox
In-Reply-To: <xmqqzi9f1lb2.fsf@gitster.mtv.corp.google.com>

```
Hi Junio,

On Thu, 28 Sep 2017, Junio C Hamano wrote:

> 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!

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

> > 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, 2017-09-28 22:03

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <xmqqzi9ezdk4.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqzi9ezdk4.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <alpine.DEB.2.21.1.1709281428170.40514@virtualbox>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> 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.
> ...
> 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, 2017-09-29 04:34

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <20170929043406.GA9325@jessie.local>
URL: https://gitlist.dev/e/20170929043406.GA9325%40jessie.local
In-Reply-To: <alpine.DEB.2.21.1.1709281428170.40514@virtualbox>

```
On Thu, Sep 28, 2017 at 02:31:17PM +0200, Johannes Schindelin 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

> 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, 2017-09-29 20:24

Subject: Re: [PATCH] gitk: expand $config_file_tmp before reporting to user
Message-ID: <544DEAEA-9F66-471A-BEC9-B3D1F3C475AD@madiva.com>
URL: https://gitlist.dev/e/544DEAEA-9F66-471A-BEC9-B3D1F3C475AD%40madiva.com
In-Reply-To: <xmqq4lrn30bz.fsf@gitster.mtv.corp.google.com>

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

> 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]\" \
> 


```
