patchGNU source-highlight - Patches: patch #8646, Fix datadir logic - don't ignore...

 
 

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

patch #8646: Fix datadir logic - don't ignore user config file

Submitter:  avih <avih>
Submitted:  Thu 09 Apr 2015 12:36:39 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Closed

Sat 12 Oct 2019 05:24:19 PM UTC, comment #5: 

Thank you.

avih <avih>
Sat 12 Oct 2019 02:26:24 PM UTC, comment #4: 

I checked this in.

Tom Tromey <tromey>
Group administrator
Sun 02 Jun 2019 05:43:44 PM UTC, comment #3: 

Just adding that I also opened https://savannah.gnu.org/bugs/?44826 at the time for the same issue, and if anyone wishes to complete this patch then bug 44826 has some more info on this.

avih <avih>
Sun 02 Jun 2019 05:09:34 PM UTC, comment #2: 

Hi,

I haven't used source-highlight for some years, and I don't remember the details of this patch.

However, I did just look at the patch, and it seems to me that the commit message and updated comments should shed decent light on the issue and fix, and, assuming the patch is correct (at the time I thought it is), updating the tests should be relatively simple if anyone wishes to complete it.

avih <avih>
Sun 02 Jun 2019 03:53:53 PM UTC, comment #1: 

Thank you for the patch.

I like the general idea here.  However when I apply
the patch, it causes some "make check" failures.
So could you fix these up?

This area could still use some love, I think, but your
patch seems like a decent start.

Tom Tromey <tromey>
Group administrator
Thu 09 Apr 2015 12:36:39 PM UTC, original submission:  

I believe the data-dir resolution logic is flawed at `source-highlight.cc`:
- `dataDir` (which should be the main value) is only set if --data-dir is used
- The hardcoded argv[0] + RELATIVEDATADIR is effectively always used for the fallback value of start_path
- Settings::retrieveDataDir() which does the heavy lifting search including using the user config file - is effectively never used

However, if we're modifying the logic to use retrieveDataDir() by default, then override with --data-dir, then the fallback using RELATIVEDATADIR will never be used since the code at fileutil.cc is such that if a path is given then the fallback start_path is never used.

This patch addressed both issues by modifying the main logic as noted above, and also the code at fileutil.cc such that start_path is used as fallback for all the cases where the file was not found instead of only for the case where a path is not given (and the file itself doesn't contain a path).

I tested this on both Linux (Ubuntu 14.04 LTS) and windows (cross-compiled using MXE from the same linux system) and both work now as expected and correctly use the env var, user settings, overridden by --data-dir and falls back correctly to RELATIVEDATADIR the file cannot be found.

avih <avih>

 

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

Attached Files
file #33613:  source-highlight.fix-datadir-path.v2.patch added by avih (6KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tromey (Posted a comment)
  • -email is unavailable- added by avih (Submitted the item)
  •  

    There are 0 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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-12 tromey Open/ClosedOpen Closed
    2015-04-09 avih Attached File- Added source-highlight.fix-datadir-path.v2.patch, #33613

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code