Skip to content
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 -c does not work for osx 10.10 after upgrade to 1.17.0 #399

Closed
markwu opened this issue Nov 19, 2014 · 8 comments
Closed

stat -c does not work for osx 10.10 after upgrade to 1.17.0 #399

markwu opened this issue Nov 19, 2014 · 8 comments
Labels

Comments

@markwu
Copy link
Contributor

markwu commented Nov 19, 2014

See 1fe60b0#commitcomment-8636924

stat -c %d . does not work for osx 10.10. But stat -f %d . works.

I am not sure it is the right fix or not.

@markwu
Copy link
Contributor Author

markwu commented Nov 19, 2014

Original code will cause the following errors:

stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
-bash: [: too many arguments
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
-bash: [: too many arguments
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

@markwu markwu changed the title stat -c does not work for osx 10.10 stat -c does not work for osx 10.10 after upgrade to 1.17.0 Nov 19, 2014
markwu referenced this issue Nov 20, 2014
@c9s c9s added the Bug label Nov 20, 2014
@marcioAlmada
Copy link
Member

@markwu what version of stat are you using? I'm not using Yosemite yet, heard about too much bugs. @c9s, do you have this issue?

@sam452
Copy link

sam452 commented Nov 25, 2014

On a new install of yosemite 10.1 I get the following after pasting in
[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc

I get this on a new terminal. So +1 to the above, sam

stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
-bash: [: too many arguments
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
-bash: [: too many arguments
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

@markwu
Copy link
Contributor Author

markwu commented Nov 26, 2014

I tihnk it is BSD stat ... come with yosemete 10.10, not GNU stat. I didn't see any version information from man stat.

@markwu
Copy link
Contributor Author

markwu commented Nov 26, 2014

You can see detail bsd stat manual here http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=1

@racklin
Copy link
Contributor

racklin commented Nov 26, 2014

@markwu @marcioAlmada @c9s
Hey guys, we are talking about shell script?

Why not just replace

curr_fs=$(stat -c %d .)

to

curr_fs=$(stat -c %d . 2>/dev/null)
if [ $? -ne 0 ]; then 
    curr_fs=$(stat -f %d . 2>/dev/null)
fi

That works both GNU and workaround for BSD style stat .

Should i sent a PR for that?

racklin added a commit to racklin/phpbrew that referenced this issue Nov 26, 2014
Signed-off-by: Rack Lin <racklin@gmail.com>
@c9s c9s closed this as completed in #412 Nov 26, 2014
@sam452
Copy link

sam452 commented Nov 28, 2014

I'm still coming up with this output when I open a new terminal. I have run phpbrew self-update. Am I misunderstanding something?

@marcioAlmada
Copy link
Member

@sam452 we had no releases including this merge yet. Soon we'll have a release with the new features and this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants