patchThe GNU Bourne-Again SHell - Patches: patch #10431, Add XDG Base Directory fallbacks...


You are not allowed to post comments on this tracker with your current authentication level.

patch #10431: Add XDG Base Directory fallbacks for Bash startup files

Submitter:  90 <ninety>
Submitted:  Fri 26 Jan 2024 07:11:11 PM UTC
Votes: 100
Category:  None Priority:  5 - Normal
Status:  Postponed Privacy:  Public
Assigned to:  None Open/Closed:  Open

Mon 18 Mar 2024 06:24:09 PM UTC, comment #5: 

I promise this will be the last amendment that I have to make to this patch. I had just forgotten this one thing.

The specification states that each XDG_ environment variable must refer to an absolute path only, and should be considered invalid and ignored in favour of the default fallback if it is instead a relative path. The patch now makes sure that these variables are only used if they hold an absolute path.

(file #55860)

90 <ninety>
Sat 09 Mar 2024 05:31:54 PM UTC, comment #4: 

Slight oversight: the last patch attached did not honour the --init-file launch option. This has now been fixed here. Also, the overall find_bash_user_file function has been rewritten and cleaned up to use asprintf instead of the manual allocation mess from before.

(file #55816)

90 <ninety>
Mon 04 Mar 2024 04:22:36 PM UTC, comment #3: 

This should hopefully be the last attempt at this patch, however I've now gone back once more and also added the BASHRC variable that you suggested some time prior on the initial support post. As usual, please let me know if there are still any problems with the current patch.

(file #55779)

90 <ninety>
Sat 02 Mar 2024 05:15:31 PM UTC, comment #2: 

Hello again. Figured I'd come back and submit a slightly reworked patch. This time, I've also included a fall-back for the ~/.bash_history file without having to manually set HISTFILE; if the legacy history file is still found first, then the default value for HISTFILE remains as such, otherwise if and only if $XDG_STATE_HOME/bash/bash_history is found, then HISTFILE will be set to that.

I grant you that the code still probably isn't particularly great, however the general idea is still there and works pretty much as required.

(file #55767)

90 <ninety>
Fri 26 Jan 2024 07:13:13 PM UTC, comment #1: 

To reiterate what was said prior in the linked support post, this patch adds the discussed XDG fall-backs for all of .bash_profile, .bash_login, .bashrc and .bash_logout. While their legacy paths are still prioritised to not subvert existing expectations, they all now have the option to be moved to an $XDG_CONFIG_HOME/bash directory without needing to be dotfiles.

The only one that does not have such a fall-back defined for it is .bash_history due to the need to preserve the existing HISTFILE default. Ideally, this would have been migrated to something like $XDG_STATE_HOME/bash/history, however users are free to set this as their HISTFILE if they so choose to.

90 <ninety>
Fri 26 Jan 2024 07:11:11 PM UTC, original submission:  

Slightly updated version of the patch submitted in sr #108134, uploaded to the appropriate place this time around under an account.

90 <ninety>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #55860:  XDGBDS_5.patch added by ninety (7KiB - text/x-patch)
file #55816:  XDGBDS_BASHRC.patch added by ninety (7KiB - text/x-patch)
file #55779:  XDGBDSwithBASHRC.patch added by ninety (6KiB - text/x-patch)
file #55618:  XDGbasedir.patch added by ninety (4KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by michaelober (Voted in favor of this item)
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by ninety (Submitted the item)

    There are 100 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-16 michaelober Carbon-Copy- Added michaelober
    2024-03-18 ninety Attached File- Added XDGBDS_5.patch, #55860
    2024-03-09 ninety Attached File- Added XDGBDS_BASHRC.patch, #55816
    2024-03-04 ninety Attached File- Added XDGBDSwithBASHRC.patch, #55779
    2024-03-02 ninety Attached File- Added 0001-Add-XDGBDS-fallbacks-for-Bash-related-files.patch, #55767
    2024-02-02 chet StatusNone Postponed
    2024-01-26 ninety Attached File- Added XDGbasedir.patch, #55618

    Back to the top

    Powered by Savane 3.13-3cd0.
    Corresponding source code