-
Notifications
You must be signed in to change notification settings - Fork 555
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
blib.pm dont shell out to "cmd.exe" on Win32+Win32.pm #22683
base: blead
Are you sure you want to change the base?
Conversation
It looks like you need to I suspect it would be better to move getcwd() from Adding (or calling) PerlEnv_get_childdir() from getcwd_sv() strikes me as a more universal solution - making getcwd_sv() more usable (or at least more efficient) on Windows, though the "always malloc" interface of win32_get_childdir() makes me sad. |
Actually, I don't see why you're getting that regen error here, and on the other PRs. I tried testing #22682 which has a similar regen failure, and couldn't reproduce it locally. Karl's PR was submitted around the same time and didn't fail. |
I would be strongly in support of adding a builtin::cwd function of some form. Cwd is a loadable module, dual life, and part of File::Spec. This combines together to be horrible for anything manipulating |
These commits came in while blead was briefly broken during the point release yesterday. I'll re-run the checks on them. |
Ok. Made no difference. The PRs must be based on top of blead when it was broken (Makefile.SH)and a fresh rebase should fix. |
I will do that since
Getting rid of that malloc is in my cross hairs, I'll just add user supplied buffer variant to Perlhost.h. Note, IMHO Since perlhost.h seems to be opaque what is perlhost.h's own internal memory allocator, actually is. Is it global C++ I will just make a user supplied buffer API for perlhost, caller first passed a good enough sized, c stk char array, aka 256+1 or 4096, if overflow of 256, (like almost never on WinOS unless you are building Chrome browser or nodejs), caller only gets length needed and overflow fail error, and must malloc an extreme length buffer, and retry again. Basically copying MS's Final note, Rev 1 of this commit , i wrote the POD as NEVER USE THIS, if it is moved to Obviously since Does P5P turn on optree inlining for As I wrote in Rev 1, other than an exotic |
builtin is not the place for "internal" or "do not use" functions. |
So put in Note, we support the XS backend as public api already, https://perldoc.perl.org/perlapi#getcwd_sv and that C func is not listed as experimental and does not site in "private api" perlintern.pod. I changed my mind in this paragraph. I say full feature/full support Any bug filed against PP If
and is calling the P5P core impl anyway.
Overall Im happy some/a yes votes appeared in this ticket. |
I think add it to builtin as experimental. Cwd itself calls getcwd_sv() (or a copy of it on really old perls) on POSIX-likes, so I think we can assume it's fairly reliable. (The getcwd() system call can validly fail on POSIX-likes.) You mention Cwd calls getcwd_sv(), but it doesn't do that on Win32, where it ends up calling Win32::GetCwd(), or on VMS. As to perlhost, we've had a fairly recent ticket where someone was asking for the ability to intercept system calls similar to what perlhost provides, though perlhost doesn't do this 100%. |
Is it a bug perl core Also I dislike the ucrt implementation of getcwd, since its a thin wrapper around
MS Detours, https://github.com/DynamoRIO/dynamorio There are other tools. Somewhere on my todo list is sending Rant and conspiracy theory on Staring at the C++ elephant, I came to realize, its real purpose was not for ithreads and psuedo fork, ActiveState and Microsoft has a different API design requirement. perlhost.h goes far beyond what is needed for psuedo-fork. Someone at MS or a MS VAR company, has a business requirement to run Win32 Perl on Unix. Yes, Win32 Perl on Unix, not Perl on Unix. Here is its real reason https://en.wikipedia.org/wiki/Internet_Explorer_for_UNIX Design requirement was libperl as a Internet Explorer ActiveX plugin, on Internet Explorer for Unix, and Win32 Perl for Unix, loads |
-document Internals::getcwd() enough, with scary warnings, for future core devs, or CPAN devs. A permanent reason for Internals::getcwd() to exist on Win32 full perl was found. See code comments. -optimize a bit the built-in perl core cwd() XSUBs, use TARG, and group stack manipulation together for C compiler variable liveness reasons aka less variables to save in non-vol regs or on C stack around function calls.
18599f6
to
284512f
Compare
Updated branch pushed, I did find a bug, Does ``Perl_getcwd_sv() |
Add builtin::getcwd Perl#3 gcc syntax fixes -win32_get_childdir() skip the strlen() because GetCurrentDirectoryA() gives it to us, handle 32KB paths if encountered. It is an infinite retry loop since its been reported, in multithreading, GCD()/CWD can change and get longer on our OS thread's between overflow Perl#1 and correct-size attempt Perl#2 because CWD val is a race cond. So all overflow conditions must trigger realloc. If the whole C stack is used up with alloca() and infinite retry. A SEGV is good. Win API/UNICODE_STRING struct is hard coded to USHORT/SHORT. If GetCurrentDirectoryA() returns above 65KB a SEGV is good. If GetCurrentDirectoryA()'s impl is doing {return buflen+1;} which is an API violation, OS is damaged, a SEGV is good. The race retry will never realistically trigger more than 1x ever, 2x rounds through retry loop might happen after a few centuries semi-guess. -CPerlHost::GetChildDir(void) is TODO now that m_pvDir->GetCurrentDirectoryA/W have correct retvals. -perllib.c silence warnings, return debug code accidentally removed in Merge WinCE and Win32 directories -- Initial patch 7bd379e 4/27/2006 7:30:00 PM
284512f
to
59087c3
Compare
Probably since perlhost maintains per pseudo-process current directories.
I'll admit I thought Win32 didn't have getcwd(), but we do use it.
I've used DrMemory on Windows, which is based on this. The user in this case wanted to use this on Linux, ActiveState still provide perl for Linux, but I don't know if they build that with
They had an IIS plugin for non-ASP use too, IIRC, which I expected used the perlhost stuff. |
So fix it and hunt down all non-ithread compatible getcwd calls for win32 ? its easy for me Tony Cook, what is your opinion on |
Yes please.
Anyone who is currently directly calling getcwd_sv() is currently getting I think it's reasonable for builtin::getcwd() to also return the native separators. |
-document Internals::getcwd() enough, with scary warnings, for future
core devs, or CPAN devs. A permanent reason for Internals::getcwd() to
exist on Win32 full perl was found. See code comments.
-optimize a bit the built-in perl core cwd() XSUBs, use TARG, and group
stack manipulation together for C compiler variable liveness reasons aka
less variables to save in non-vol regs or on C stack around function
calls.