Opened 8 years ago

Closed 7 years ago

#51700 closed defect (fixed)

sunwait @0.8: Fails on MacOS 10.11.5

Reported by: Buadhai Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch Cc: petermarkley (Peter Markley)
Port: sunwait

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Examples:

Bleach:~ mnewman$ date
Fri Jun 24 12:17:54 ICT 2016
Bleach:~ mnewman$ sunwait poll 14.966548N 102.043904E
NIGHT

Bleach:~ mnewman$ sunwait report 14.966548N 102.043904E
Segmentation fault: 11

Bleach:~ mnewman$ sunwait list 14.966548N 102.043904E
201751737:32717, 201764716:33391

Same version works fine on Raspbian:

pi@rasp ~ $ date
Fri Jun 24 12:24:39 ICT 2016
pi@rasp ~ $ sunwait poll 14.966548N 102.043904E
DAY
pi@rasp ~ $ sunwait report 14.966548N 102.043904E

      Current Date and Time: 24-Jun-2016 12:25 ICT


Target Information ...

                   Location:  14.966548N, 102.043904E
                       Date: 24-Jun-2016
                   Timezone: ICT
   Sun directly north/south: 12:14
             Twilight angle: -0.83 degrees (daylight)
          Day with twilight: 05:43 to 18:45
                      It is: Day (or twilight)

General Information (no offset) ...

 Times ...         Daylight: 05:43 to 18:45
        with Civil twilight: 05:20 to 19:08
     with Nautical twilight: 04:53 to 19:36
 with Astronomical twilight: 04:24 to 20:04

 Duration ...    Day length: 13:03 hours
        with civil twilight: 13:48 hours
     with nautical twilight: 14:44 hours
 with astronomical twilight: 15:41 hours

pi@rasp ~ $ Bleach:~ mnewman$ sunwait list 14.966548N 102.043904E^C
pi@rasp ~ $ sunwait list 14.966548N 102.043904E
05:43, 18:45

Attachments (2)

sunwait_crash.txt (10.3 KB) - added by Buadhai 8 years ago.
Crash Log
sunwait_diff.txt (397 bytes) - added by petermarkley (Peter Markley) 7 years ago.
Changes to sunwait.cpp

Download all attachments as: .zip

Change History (13)

Changed 8 years ago by Buadhai

Attachment: sunwait_crash.txt added

Crash Log

comment:1 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Summary: Sunwait 0.8 Fails on MacOS 10.11.5sunwait @0.8: Fails on MacOS 10.11.5

comment:2 Changed 8 years ago by Buadhai

I just want to add that this happened on the two Macs that I own, a 2009 MacMini and a more recent MacBook Air. I can pinpoint that it happened on the MacBook Air when I ran port upgrade outdated on June 11th of this year.

Last edited 8 years ago by Buadhai (previous) (diff)

comment:3 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

I agree, it crashes for me too. You should report the problem to the developer of sunwait so that it can be fixed: https://sourceforge.net/p/sunwait4windows/discussion/general/

comment:4 Changed 8 years ago by Buadhai

I don't think it's the developer's problem. The linux version 0.8 works fine for me under Raspbian. It's only the Mac version 0.8 that fails, so I think it's a Macports problem.

comment:5 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

It must be the developer's problem; we're not doing anything special in the portfile. We're just downloading the source code the developer provides, applying a few patches to fix compile errors, and then compiling it. The crash seems to be occurring in the operating system function strftime, which suggests sunwait isn't calling strftime correctly. The developer needs to be informed this problem exists so they can fix it.

The sourceforge project is called "sunwait4windows" which may explain why it hasn't been extensively tested on the Mac.

I checked the sourceforge project, and for some reason the button to create a new ticket is disabled. I emailed the developer to ask how we should report bugs.

comment:6 Changed 8 years ago by Buadhai

I think I understand, but I'd like to ask a question because I want to learn something here.

If the sunwait source is calling strftime incorrectly, then why does sunwait 0.8 work fine when compiled for Raspbian but fail when compiled for OSX?

comment:7 Changed 7 years ago by petermarkley (Peter Markley)

Hey guys, I took a peek in the source code and this problem is ridiculously simple. Parts of the code are wrapped in ifdefs that neglect OSX, and they therefore don't execute. The variables passed to strftime are never populated with sane numbers on OSX. I added __APPLE__ to all the Linux code blocks, recompiled, and it works fine.

I have notified the developer.

comment:8 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: petermarkley added

Thanks, Peter. Could you attach a diff of your changes?

Changed 7 years ago by petermarkley (Peter Markley)

Attachment: sunwait_diff.txt added

Changes to sunwait.cpp

comment:9 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign removed
Owner: changed from macports-tickets@… to ryandesign
Status: newaccepted

Probably want to check if __APPLE__ is defined, rather than checking its value, since it won't have a value on non-Apple systems. Other than that, looks good to me, and I'll commit it in a second.

comment:10 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

comment:11 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 1c69828ba68c9a5f582a60b16fa557bb877989c1/macports-ports:

sunwait: Work correctly on macOS

Closes: #51700

Note: See TracTickets for help on using tickets.