make fullcheck fails on my computer: flac cannot recognize --skip option that contains decimal point, e.g. "--skip=1.234". System locale uses comma as a separator, so strtod/atof expect comma, not point, and "make fullcheck" fails. Here's what I can see in FLAC source code: atof() function found in: file: src/share/grabbag/seektable.c function: grabbag__seektable_convert_specification_to_template() (option: -S) strtod() function found in: src/flac/main.c parse_option() (--apply-replaygain-which-is-not-lossless) src/flac/utils.c local__parse_timecode_() <= flac__utils_parse_skip_until_specification() (--skip, --until) src/libFLAC/stream_encoder.c FLAC__stream_encoder_set_apodization() (-A gauss, -A tukey) src/share/grabbag/cuesheet.c local__parse_ms_() <= local__cuesheet_parse_() <= grabbag__cuesheet_parse() src/share/grabbag/replaygain.c parse_double_() <= grabbag__replaygain_load_from_vorbiscomment() *** comments *** 1) local__parse_ms_() have strspn(s, "0123456789.") so decimal comma is not allowed in cuesheets 2) local__parse_timecode_() have strspn(s, "1234567890.,") so comma is allowed in --skip and --until options 3) grabbag__replaygain_load_from_vorbiscomment() uses the following sequence: setlocale(LC_ALL, "C"); use printf/strtod; setlocale(LC_ALL, saved_locale); so RG tags always have decimal point 4) flac and metaflac: main() calls setlocale(LC_ALL, "") which sets default system locale 5) Probably it's better to use local version of strtod() that accepts both comma and point as separators (just as FLAC uses local_strdup or flac_snprintf).
Erik de Castro Lopo
2014-May-18 06:47 UTC
[flac-dev] make fullcheck fails: strtod/atof and locale
I've had a couple of looks at this issue and I'm still not sure what to do. lvqcl wrote:> make fullcheck fails on my computer: flac cannot recognize --skip option > that contains decimal point, e.g. "--skip=1.234". > > System locale uses comma as a separator, so strtod/atof expect comma, not point, > and "make fullcheck" fails.Does adding: export LANG=C LC_ALL=C to the top of the file test/test_grabbag.sh help? Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo wrote:> Does adding: > > export LANG=C LC_ALL=C > > to the top of the file test/test_grabbag.sh help?No. But all tests in test_grabbag.sh passed OK, it's test_flac.sh that fails. And test_flac.sh already have this 'export' command in the beginning. I found this page -- http://sourceforge.net/p/mingw-w64/bugs/307/ Quote: "This is not a problem with mingw-w64 but a problem with setlocale() which we import from MS dlls". And indeed, flac.exe imports setlocale from MSVCRT.DLL. So no wonder that it's not fully POSIX compatible and doesn't care about environment variables. BTW, FLAC documentation (e.g. http://xiph.org/flac/documentation_tools_flac.html ) doesn't mention the fact that decimal separator is locale-dependent; IMHO this fact should be mentioned there.