bugGNU nano - Bugs: bug #57367, nano-4.6 fails to build from...

 
 

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

bug #57367: nano-4.6 fails to build from source on macOS

Submitter:  Bo Anderson <bo98>
Submitted:  Fri 06 Dec 2019 01:35:56 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Tue 24 Dec 2019 09:13:30 AM UTC, comment #8: 

The fix has been released in 4.7.

Benno Schulenberg <bens>
Group administrator
Fri 06 Dec 2019 02:57:23 PM UTC, comment #7: 

Thanks for the fix Benno.

(hunspell is an available package in both too - thanks for letting me know.)

Bo Anderson <bo98>
Fri 06 Dec 2019 02:55:11 PM UTC, comment #6: 

Thanks for confirming.  Pushed to master in commit f516cddc.

(Yes, nano can use aspell and ispell, but this requires configuration.  When hunspell is installed, though, nano will use it instead of spell, without needing any configuration.)

Benno Schulenberg <bens>
Group administrator
Fri 06 Dec 2019 02:25:55 PM UTC, comment #5: 

I can confirm the patch works fine.

macOS does not have 'spell' installed by default. That said, the Homebrew and MacPorts package managers do offer both aspell and ispell which I understand can be used in nano.

Bo Anderson <bo98>
Fri 06 Dec 2019 11:26:23 AM UTC, comment #4: 

Thanks for confirming the equivalence (for our purposes) of st_mtim and st_mtimespec.  Then the attached patch (instead of the snippet) should solve the issue too, right?

Something else, but related: does macOS have 'spell' installed by default?  That is: does ^T in nano work out of the box?

(file #48016)

Benno Schulenberg <bens>
Group administrator
Fri 06 Dec 2019 09:58:36 AM UTC, comment #3: 

Yes, the old BSD st_mtimespec can be seen as the same as st_mtim - they have the same type. The snippet you provided fixes the compile.

Bo Anderson <bo98>
Fri 06 Dec 2019 09:38:23 AM UTC, comment #2: 

Sorry, I meant:


#ifdef __APPLE__
#ifndef st_mtim
#define st_mtim st_mtimespec
#endif
#endif


Benno Schulenberg <bens>
Group administrator
Fri 06 Dec 2019 09:36:43 AM UTC, comment #1: 

Thanks for reporting.  But... it's unclear to me how to fix this.  Does the st_mtimespec thing have both a .tv_sec and a .tv_nsec member?  If yes, does adding the following lines at the top of src/text.c allow the file to be compiled on macOS?


#ifdef __APPLE__
#ifndef st_mtime
#define st_mtime st_mtimespec
#endif
#endif


Benno Schulenberg <bens>
Group administrator
Fri 06 Dec 2019 01:35:56 AM UTC, original submission:  

Nano 4.6 now uses the st_mtim field in the stat struct. This field was only formalised in POSIX:2008, while macOS still implements POSIX:2001. Prior to inclusion in the POSIX standard, BSD operating systems used st_mtimespec instead (unless the strict _POSIX_SOURCE is defined in which case you have st_mtime and st_mtimensec).


text.c:2529:33: error: no member named 'st_mtim' in 'struct stat'
        timestamp_sec = (long)fileinfo.st_mtim.tv_sec;
                              ~~~~~~~~ ^
text.c:2530:34: error: no member named 'st_mtim' in 'struct stat'
        timestamp_nsec = (long)fileinfo.st_mtim.tv_nsec;
                               ~~~~~~~~ ^
text.c:2570:21: error: no member named 'st_mtim' in 'struct stat'
        if ((long)fileinfo.st_mtim.tv_sec == timestamp_sec &&
                  ~~~~~~~~ ^
text.c:2571:20: error: no member named 'st_mtim' in 'struct stat'
                                (long)fileinfo.st_mtim.tv_nsec == timestamp_nsec) {
                                      ~~~~~~~~ ^
4 errors generated.



See also: gnulib's `get_stat_mtime` which has checks in place for the above. Alternatively, `_POSIX_VERSION` checks will probably be sufficient for macOS.

Bo Anderson <bo98>

 

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by bo98 (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-24 bens Open/ClosedOpen Closed
    2019-12-06 bens StatusIn Progress Fixed
        SummaryNano 4.6 fails to build from source on macOS nano-4.6 fails to build from source on macOS
    2019-12-06 bens Attached File- Added 0001-build-fix-compilation-on-macOS-where-st_mtim-is-unkn.patch, #48016
        StatusNone In Progress
    2019-12-06 bens Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code