- 
                Notifications
    You must be signed in to change notification settings 
- Fork 399
          docs(README): Suggest using completionsdir as a fallback
          #1379
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, but in the same answer we later refer to datarootdir instead of datadir. I've read the descriptions of the two, became confused, but was left with the feeling that datadir would actually be what we should be using (mostly because the datadir description mentions it actually being the dir for installing things into, datarootdir does not). We also use datadir for the replacements we do for the .pc file, not datarootdir.
This is not the fault of this change, but as it makes the difference so obvious, I'd like to discuss here what to do about it. I guess I'm suggesting this (to be done in another commit/PR):
@akinomyoga your thoughts on this? Based on git log you were involved with the commit that added these two mentions, 530017d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar too, but according to the documentations,
datadirseems better.datarootdirseems to be intended as the root directory for various directories with special functions, such asshare/info,share/locale,share/man,share/doc, andshareitself. I agree with applying these changes. In addition, I think we need to addinclude(GNUInstallDirs)for the CMake example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#1415
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading Directory Variables (GNU Coding Standards), I think
datarootdirmakes sense for third party projects providing completions:So it allows distributor to override
datadirfor a third party project without installing the completion file to a path bash-completion will not be able to find it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the same document a couple of days ago and came to the opposite conclusion. They could have overridden datadir for bash-completion and in that case installing 3rd party completions to datarootdir would install to a location that's not looked up from.
Anyway, anything that's not using the .pc file to figure out locations to install is doing it the fragile way, and gets to keep both pieces when it breaks :). If this would be a robust way to do it, I suppose there would be no need for the .pc file in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, it cuts both ways.
Though overriding
datadirforbash-completionmakes even less sense than doing that for programs, in my opinion:completionsdirfor every program trying to install completions without the use of pkg-config file. (I guess autotools introducingdatarootdirpredatespkg-config.)--datadirin order allow simultaneous installations of different versions of software. I do not see a reason to do that for nexus-establishing software likebash-completionother thanvanityorganisation.Right.
datarootdiris precisely what prevents this mismatch when overridingdatadirfor programs, nexūs should be still found indatarootdir. Though we do not actually supportdatarootdirin our pkg-config file so we would encounter the same issue here:bash-completion/bash-completion.pc.in
Line 6 in c55ee7f
Programs are still expected to override variables in
pkg-configpaths so they could usepkg-configto supportdatarootdirwithpkg-config bash-completion --variable=completionsdir --define-variable=datadir=$datarootdir. But without guidance from us, this is pretty unlikely.If we want to fix that, we could modify the pkg-config file, introducing
datarootdir=@datarootdir@and replacingdatadirvalue with${datarootdir}. This is a somewhat common pattern I have seen in pkg-config files (example) before projects started switching en masse to Meson, which does not supportdatarootdir.Alternately, we could decide supporting separate
datarootdiris not worth the trouble until someone comes up with an actual convincing use case.