Bug 402335

Summary: mtp/kiod_module/mtpstorage.cpp:548:81: error: no member named 'st_mtim' in 'stat'
Product: [Frameworks and Libraries] kio-extras Reporter: Yurii Kolesnykov <yurii.kolesnykov>
Component: defaultAssignee: Plasma Bugs List <plasma-bugs-null>
Status: REPORTED ---    
Severity: normal CC: ramos.kieran, yurii.kolesnykov
Priority: NOR    
Version First Reported In: 18.12.0   
Target Milestone: ---   
Platform: Homebrew (macOS)   
OS: macOS   
URL: https://github.com/KDE-mac/homebrew-kde/blob/master/Formula/kio-extras.rb
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch

Description Yurii Kolesnykov 2018-12-19 07:43:35 UTC
kio-extras doesn't build after 18.12 release


STEPS TO REPRODUCE
1. Try to build kio-extras under macOS

OBSERVED RESULT
build fails with error
https://gist.github.com/d9176b08b5d59f328f194f90041def88

EXPECTED RESULT
kio-extras builds fine

SOFTWARE/OS VERSIONS
MacOS: 10.14.2
KDE Frameworks Version: 5.53
Qt Version: 5.12
Comment 1 Kieran Ramos 2018-12-29 03:39:24 UTC
I have more details on the problem:

On Ubuntu 'st_mtim' is a timespec struct, but on Darwin the same timespec struct (defined in stat.h) is called 'st_mtimespec'. There is a macro for 'st_mtim.tv_sec' on Ubuntu called 'st_mtime'. The same macro is available in Darwin (defined as 'st_mtimespec.tv_sec') so I think all that is necessary is to change line 548 of mtpstorage.cpp to 'srcBuf.st_mtime'.

Here is where the macro is defined on Darwin in stat.h:

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec
#define st_ctime st_ctimespec.tv_sec
#define st_birthtime st_birthtimespec.tv_sec
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
Comment 2 Kieran Ramos 2018-12-29 03:58:06 UTC
Created attachment 117165 [details]
Patch

I've attached a patch to mtpstorage.cpp. With this patch kio-extras builds on macOS (via Homebrew KDE repo), but I don't know how to verify the functionality is correct.