You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 2.5.6 (d308b74, particularly), if $XDG_DATA_HOME is valid, tig runs mkdir(dirname(path), 0777);. However, dirname() may modify the string pointed to by path [1]. If that happens, path no longer points to the desired history file.
For example, on Arch LInux, dirname() changes path from
"/home/yen/.local/share/tig/history\0"
to
"/home/yen/.local/share/tig\0history\0"
The following open() fails as path is now a directory, and the fallback ~/.tig_history is used.
By the way, is it a good idea to use permission 0777?
@yan12125 , thanks for reporting and fixing the issue. To my dismay, macOS version of dirname() does not behave the same as Linux version, so I missed that. 0777 is further restricted by the user's umask, I don't think we have a reason to be more restrictive.
Since 2.5.6 (d308b74, particularly), if
$XDG_DATA_HOME
is valid, tig runsmkdir(dirname(path), 0777);
. However, dirname() may modify the string pointed to by path [1]. If that happens, path no longer points to the desired history file.For example, on Arch LInux, dirname() changes path from
"/home/yen/.local/share/tig/history\0"
to
"/home/yen/.local/share/tig\0history\0"
The following open() fails as path is now a directory, and the fallback ~/.tig_history is used.
By the way, is it a good idea to use permission 0777?
[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirname.html
The text was updated successfully, but these errors were encountered: