"I think the first thing to obtain and peruse is the perl -V output from the user's m1/m2 system"
here you go:
Summary of my perl5 (revision 5 version 34 subversion 1) configuration
+:
Platform:
osname=darwin
osvers=22.3.0
archname=darwin-thread-multi-2level
uname='darwin venturaa.local 22.3.0 darwin kernel version 22.3.0:
+mon jan 30 20:39:35 pst 2023; root:xnu-8792.81.3~2release_arm64_t8103
+ arm64 '
config_args='-des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin -
+Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrpli
+b -Dcc=/usr/bin/cc -Dman1ext=1pm -Dman3ext=3pm -Dinstallstyle=lib/per
+l5 -Dman1dir=/opt/local/share/man/man1p -Dman3dir=/opt/local/share/ma
+n/man3p -Dsitebin=/opt/local/libexec/perl5.34/sitebin -Dsiteman1dir=/
+opt/local/share/perl5.34/siteman/man1 -Dsiteman3dir=/opt/local/share/
+perl5.34/siteman/man3 -Dvendorbin=/opt/local/libexec/perl5.34 -Dvendo
+rman1dir=/opt/local/share/perl5.34/man/man1 -Dvendorman3dir=/opt/loca
+l/share/perl5.34/man/man3 -Dpager=/usr/bin/less -sR -Dperlpath=/opt/l
+ocal/bin/perl5.34 -Dstartperl=#!/opt/local/bin/perl5.34 -Acppflags=-I
+/opt/local/include -Accflags=-pipe -Os -Alddlflags=-L/opt/local/li
+b -Wl,-headerpad_max_install_names -Aldflags=-L/opt/local/lib -Wl,-
+headerpad_max_install_names '
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='/usr/bin/cc'
ccflags ='-fno-common -DPERL_DARWIN -pipe -Os -fno-strict-alias
+ing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUT
+ENV'
optimize='-O3'
cppflags='-I/opt/local/include -fno-common -DPERL_DARWIN -pipe -
+Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/inclu
+de'
ccversion=''
gccversion='Apple LLVM 14.0.0 (clang-1400.0.29.202)'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=8
longdblkind=0
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='/usr/bin/cc'
ldflags =' -L/opt/local/lib -Wl,-headerpad_max_install_names -f
+stack-protector-strong'
libpth=/opt/local/lib /Library/Developer/CommandLineTools/usr/lib/
+clang/14.0.0/lib /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.
+sdk/usr/lib /Library/Developer/CommandLineTools/usr/lib /usr/lib
libs=-lgdbm
perllibs=
libc=
so=dylib
useshrplib=true
libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=bundle
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -W
+l,-headerpad_max_install_names -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Built under darwin
Compiled at Feb 24 2023 04:18:24
@INC:
/opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level
/opt/local/lib/perl5/site_perl/5.34
/opt/local/lib/perl5/vendor_perl/5.34/darwin-thread-multi-2level
/opt/local/lib/perl5/vendor_perl/5.34
/opt/local/lib/perl5/5.34/darwin-thread-multi-2level
/opt/local/lib/perl5/5.34
I'm not really sure what to look for in this output, I see USE_LOCALE_NUMERIC among the active compile time options but that's also the case with the Perl on my Linux PC so that by itself should not be the cause of the issue. | [reply] [d/l] |
I'm not really sure what to look for in this output...
I think the main thing is that we can now see that we're not dealing with an old perl, that PERL5OPT (and/or other perl-specific environment variables) have not been set, and that everything looks sane.
The main thing is that you look for a "standout" difference between that output and the output that you get.
If there's nothing to be seen there, as is apparently the case, then at least we know to look elsewhere.
AFAICS, the issue should be reproducible on the problem machine by running this script:
use warnings;
#use Tk;
print "result:\n";
$_A = '16.25'; # string, not number
$_V = '12.99'; # string, not number
$formula = 'sprintf("%.0f", ($_V * $_A))';
$_W = eval($formula);
print "$_V\n";
print "$_A\n";
print "$_W\n";
If that doesn't reproduce the problem, then I would begin reinstating bits of the original script to it (starting by commenting in the "use Tk;" line) until you hit the point where the problem does kick in.
It's an interesting one ... even if that simplified test script successfully demonstrates the bug, then there's still the question of "why and how ??".
But let's not get too far ahead of ourselves ;-)
UPDATE: If the script I provided did not tickle the bug, then how about this one that fully reinstates the Tk stuff:
use warnings;
use Tk;
my $mw=MainWindow->new();
$mw->Button(-text=>" Test ", -command=>sub{test()}, -font=>'Helvet
+ica 18 bold', -pady=>20)->pack();
MainLoop;
sub test {
print "result:\n";
$_A = '16.25'; # string, not number
$_V = '12.99'; # string, not number
$formula = 'sprintf("%.0f", ($_V * $_A))';
$_W = eval($formula);
print "$_V\n";
print "$_A\n";
print "$_W\n";
}
Cheers, Rob | [reply] [d/l] [select] |
Rob, I really appreciate your effort but the problem is that as I said before I do not have direct access to the problem machine.
I had started this thread with the hope that among the many Perl experts here on Perlmonks there would be somebody using a M1/M2 Mac with MacPorts Perl who could run my test script and confirm or disprove the issue so that in case the issue is confirmed I could then open a bug report at macports.
What you are suggesting is more back and forth between me and the user of my application which is exactly what I wanted to avoid as I feel I'm straining his willingness to help.
Before asking the user of my application to test any further variants of the test script (which certainly would make sense to narrow down further the root cause) I first of all need confirmation that my test script included in the first post of this thread does trigger the issue also on other M1/M2 Macs, i.e. that it's not a unique issue with his particular setup.
I'm starting to realize that it was a bad idea to add macOS (or at least macOS on ARM cpus, for macOS on Intel I can set up a hackintosh if necessary) to the supported platforms for my application, as I have no way to reproduce any platform related issues. I was naive in thinking that since macOS is Unix based Perl would work just the same as on Linux, but apparently that's not really the case.
| [reply] |
I will see if I can get that output but I haven't gotten any reply in almost a week to my last message to the macOS M1 the user of my application so I don't know if and when I will get it. | [reply] |
I will see if I can get that output but I haven't gotten any reply in almost a week to my last message ...
Yes, please do follow up here with any additional info that becomes available.
I find it interesting to understand how such weird behaviour, as you've described, becomes possible.
So far, I can't think of anything other than "use integer" or maybe some locale issue (both of which have already been mentioned).
But who knows what else there might be lurking about ;-)
Cheers, Rob
| [reply] |