-
Notifications
You must be signed in to change notification settings - Fork 184
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
stat
uses GNU-specific -c
format parameter
#180
Comments
I just ran into this myself, also trying to connect to an OSX machine, and was able to get all the functionality I need for my own application by creating a patch (#196) like that described above by @abarnert. Also, 👍 to the actual format strings above; I got the same results myself by translating the existing format strings via the darwin & linux On my OSX Yosemite system, this patch brings I agree with everything that @abarnert said above about introducing a lot of complexity with this... interoperability with OSX is really great for what I'm working on, but for a lot of folks, this sort of platform-specific cruft is a slippery slope of complexity bloat. |
Same issue with Solaris, AIX, and HPUX. Why is the OS module not used instead? If that's not possible then a module for istat might have to be created. For the former two I was lucky and found coreutils at http://www.opencsw.org/packages/CSWcoreutils/ and http://www.perzl.org/aix/index.php?n=main.coreutils. HPUX looks like it has it at http://hpux.connect.org.uk/hppd/hpux/Gnu/coreutils-8.22/ but I've not tested that yet. |
This should be improved (for FreeBSD) by #220. |
I believe the patch fixed this for common systems. Reopen if there are further problems! |
(After #176 and some solution to #178, this is the last thing preventing ZeroDeploy from at least successfully constructing a remote connection to a Mac; I don't know if it's sufficient to make everything actually work…)
stat -c
is a GNU extension.In fact,
stat
itself is a NetBSD/FreeBSD extension that GNU copied with different parameters, but I'll get to that later.On *BSD, you use
-f
to specify a format string. And instead of having a bunch of variations of each field, you have a smaller set of fields and a bunch of modifiers that can be applied to any of them—e.g., instead of%u
for uid and%U
for username, there's%u
for user and%Su
for string user. Also, the values for BSD%HT
aren't exactly the same as the ones for GNU%F
, but fortunately the three that you check for are the same. So, to make the threestat
-based methods inBaseRemoteMachine
to work, you just need to change the arguments to (respectively):-f'%u,%Su'
-f'%g,%Sg'
'%HT,%Xp,%i,%d,%l,%u,%g,%z,%a,%m,%c'
Meanwhile, for other platforms like Solaris, there is no
stat
command at all. I suppose you could write something that parses the output ofls -l
, which I think should be sufficient for the places you're actually using it inplumbum
andrpyc
—but not for code that users have written that depend on a realstat
result.Also, I'm not sure how to patch this. The try/fallback idea I suggested for
env -0
in #178 doesn't seem like a good idea for every singlestat
call. So you probably want to do something like this:But doing this same set of checks in at least four places (these three methods, plus the
env
one) doesn't seem like a good idea. Maybe we want to centralize the tests inself.gnu_userland()
andself.bsd_userland()
functions? (Of course these two userlands aren't monolithically consistent, but if you stick to things that were in, respectively, glibc 2.1 and both NetBSD 2.0 and FreeBSD 5.0, that's probably safe enough, I hope.)The text was updated successfully, but these errors were encountered: