| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PerlIO layer types have this property that flags if they can accept
multiple arguments or only one. Unfortunately, this always checks the
uppermost layer that has an Open method defined. This causes issues when
used with utf8 or bytes on top of a layer that uses multiple arguments.
For 5.15 I think abolishing this feature may make most sense. It's just
flat out wrong IMO, it's the layer that uses the arguments that should
validate them, not the topmost, which may not even touch them. In the
mean time adding the multiargs flag to :utf8 and :bytes is a reasonable
stop-gap.
This patch makes perl slightly more permissive, so it shouldn't break
any working code out there.
|
|
|
|
|
| |
7826b36fbbf24cfa659558ee5af3de424faa2d5a changed the behavior of
PerlIOCrlf_pushed but its comment wasn't updated along with it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
or on close() in either thread.
close() in one thread blocks until close() is called in the other
thread, because both closes are waiting for the child process to end.
Since we have a reference-counting mechanism for the underlying
fileno, we can use that to determine whether close() should wait.
This does not solve the problem of close $OUT block when it has been
duplicated via open $OUT2, ">&" and $OUT2 is still in scope.
|
|
|
|
|
| |
When pushed on top of the stack, crlf will no longer enable crlf layers
lower in the stack. This will prevent unexpected results.
|
|
|
|
| |
Signed-off-by: Ævar Arnfjörð Bjarmason <avar@cpan.org>
|
|
|
|
| |
Follow-up to 81fe74fb3f93457df8e864c91546ac6b860657fc.
|
|
|
|
|
| |
Made a ':raw' open do what it advertises to do (first open the file,
then binmode it), instead of leaving off the top layer.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81904]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 >
Signed-off-by: Abigail <abigail@abigail.be>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently if an operation on a file handle is interrupted, and if
the signal handler accesses that same file handle (e.g. closes it),
then perl will crash. See [perl #75556].
This commit provides some basic infrastructure to avoid segfaults.
Basically it adds a lock count field to each handle (by re-purposing the
unused flags field in the PL_perlio array), then each time a signal
handler is called, the count is incremented. Then various parts of PerlIO
use a positive count to change behaviour. Most importantly, when layers
are popped, the PerlIOl structure is cleared, but not freed, and is left
in the chain of layers. This means that callers still holding pointers to
the various layers won't access freed structures. It does however mean
that PerlIOl structs may be leaked, and possibly slots in PL_perlio. But
this is better than crashing.
Not much has been done to give sensible behaviour on re-entrancy; for
example, a buffer that has already been written once might get written
again. Fixing this sort of thing would require a large-scale audit of
perlio.c.
|
|
|
|
|
|
| |
In some places it already checks for a null tab field; extend that
coverage. This is in preparation for a commit which may leave active
layers with a null tab field.
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, the PL_perio table was initialised by calling PerlIO_allocate,
and throwing away the result. Since a slot with a null ->next was regarded
as freed, the next call to PerlIO_allocate would reuse that slot, which is
important, as STDIN etc are expected to occupy slots 1,2,3.
Once reference counting of the slots is introduced, however, the first
slot will leak, and STDIN etc will be assigned to the wrong slots. So do it
properly now.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows any layer to find the top of the layer stack,
or more specifically, the entry in PL_perlio that points to
the top.
Needed for the next commit, which will implement a reference counting
scheme.
There's currently a bug in MakeMaker which causes several extensions to
miss the dependency on perliol.h having changed, so this commit includes
a gratuitous whitespace change to perl.h to hopefully force recompilation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Layers in PerlIO are implemented as a linked list of PerlIOl structs;
eaxch one has a 'next' field pointing to the next layer. Now here's the
clever bit: When PerlIO* pointers are passed around to refer to a
particular handle, these are actually pointers to the 'next' field of the
*parent* layer (so to access the flags field say of a PerlIOl, you have to
double-defref it, e.g. (*f)->flags). The big advantage of this is that
it's easy for a layer to pop itself; when you call PerlIO_pop(f), f is a
pointer to the parent's 'next' field, so pop(f) can just do
*f = (*f)->next.
This means that there has to be a fake 'next' field above the topmost
layer. This is where PL_perlio comes in: it's a pointer to an arena of
arrays of pointers, each one capable of pointing to a PerlIOl structure.
When a new handle is created, a spare arena slot is grabbed, and the
address of that slot is returned. This also allows for a handle with no
layers.
What this commit does is change PL_perlio from being an array of
PerlIO* into an array of PerlIOl structures - i.e. each element in the
array goes from being a single pointer, to having several fields. These
will be made used of in follow-up commits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When perlio flushes down to the unix layer, it can introduce a
spurious record boundary when writing to a record-oriented file.
Perl may create such files when doing edit-in-place or any other
context where the file format is inherited from a previous
version of the file.
The problem can be eliminated by enabling line buffering on such
files when they are opened. This was a regression in 5.10.0 since
before that stdio's buffering performed the same function.
N.B. Lines longer than the size of the perlio buffer will still
result in multiple records -- a larger buffer may be necessary.
For more details and discussion see:
http://www.nntp.perl.org/group/perl.vmsperl/2010/11/msg15419.html
Thanks to Martin Zinser for the problem report.
|
|
|
|
|
|
|
| |
PERLIO_BUFSIZ was already in use by Encode::Unicode for the
PerlIOEncode_xxx layer, so it makes sense to specify that this
macro is for the PerlIOBuf_xxx layer and that it is a default
value that may eventually be settable at run-time.
|
|
|
|
|
|
|
|
|
|
|
| |
The 4K buffer size was chosen way back in bb9950b. Significant performance
improvements are seen with larger buffer sizes, though the optimum size
likely varies by architecture and workload. For starters, we'll leave the
default as-is but make the buffer size a macro and thus user-configurable via:
sh Configure -Accflags=-DPERLIO_BUFSIZ=<number>
Choosing a better (larger) default is still TODO.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expose cop hint hashes as a type COPHH, with a cophh_* API which is a
macro layer over the refcounted_he_* API. The documentation for cophh_*
describes purely API-visible behaviour, whereas the refcounted_he_*
documentation describes the functions mainly in terms of the
implementation. Revise the cop_hints_* API, using the flags parameter
consistently and reimplementing in terms of cophh_*. Use the cophh_*
and cop_hints_* functions consistently where appropriate.
[Modified by the committer to update two calls to
Perl_refcounted_he_fetch recently added to newPMOP.]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
please find attached a patch against blead originating from [1] ,
that improves the "Layer does not match this perl" error message by
telling the user which IO layer failed and how. I've tested the
patch against a recent bleadperl and even without the modifications
to perldiag.t all tests pass. Still, for completeness, I've patched
perldiag.t as well.
The code is not mine, it was written and posted by Tye McQueen, I've
just tested it [2] and ferry the information. I'm aware that this
patch is too late for 5.12 , but in the sense of improving Perl in
the long run, I hope the change still makes it into a version of
Perl.
-max
[1] http://perlmonks.org/?node_id=829815
[2] Certified Works On My Machine, 2010
|
|
|
|
|
|
|
|
|
| |
This restores the perl 5.10/12 behaviour, making open treat \$foo as a
scalar reference if it is a glob copy (SvFAKE).
It also fixes an existing assertion failure that the test now trig-
gers. PerlIOScalar_pushed was not downgrading the sv before set-
ting SvCUR.
|
|
|
|
|
| |
PerlIO_layer_from_ref must not treat a real glob as a scalar. This
function was not updated when SVt_PVGV was moved before SVt_PVLV.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When perlio became the default and unixio became the default bottom
layer, the most common path for creating files from Perl became
PerlIOUnix_open, which has always explicitly used 0666 as the
permission mask. This has the following undesireable effects on
VMS:
1.) The execute bit is lost regardless of whether it's in the default
permissions.
2.) Delete permission (which doesn't exist in the Unix permission mask) is
copied from write permission, so granting write permission also grants
delete even if it's not in the default permission mask. This can result
in an inadvertent widening of permissions.
3.) System permissions (which don't exist in the Unix permission mask) are
copied from owner permissions, so any distinction between system and
owner is lost.
4.) ACLs are not inherited. For example, setting a default_protection ACE
on a directory such that all world access is disallowed will be ignored;
world will have the intersection of RWD (the final 6 in 0666) and whatever
the default permissions are regardless of what the ACL says. Thus not
inheriting ACLs can result in the inadvertent widening of permissions.
The way to avoid all of this is to pass 0777 as the permissions to open().
In the VMS CRTL, 0777 has a special meaning over and above intersecting
with the current umask; specifically, it allows Unix syscalls to preserve
native default permissions. Details currently documented at:
http://h71000.www7.hp.com/doc/732final/5763/5763pro_060.html#umask_routine
|
|
|
|
|
| |
sv can't actually be used uninitialized, but set it to zero to
shut up stupid compilers
|
| |
|
| |
|
|
|
|
|
|
| |
When -T is enabled, or when $ENV{TMPDIR} is bogus, perlio.c used a pathname
matching </tmp/PerlIO_??????>. However, it was only correctly unlinking the
file for the case of -T enabled.
|
| |
|
|
|
|
|
|
|
| |
Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code
size (about 0.2%), for 1 more function call if warnings are not enabled.
However, if we're now in the L1 or L2 cache when we weren't previously, that's
still going to be a speed win.
|
|
|
|
| |
since 5.005
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While I am firmly in the school of "do not look at $! except immediately
after a failure", I also agree that spuriously setting it is messy. But
there is just no way of knowing where your errno might have been.
The problem was that PerlIO_fast_gets() (and other nearby similar
capability-checking PerlIO routines) set the errno (and it was being
called a lot, from sv_gets()). I think setting the errno here was
a mistake: checking for "can has FOO" should not set external state,
such as the errno. The patch removes that errno trashing from all those
routines.
|
|
|
|
|
|
|
| |
Use a default of /tmp on Unixes when TMPDIR is unset or empty, or
when creation of a temporary file in it fails
This goes on top of commit 26e8050aaf2eeca2f04cdc7bc5df07f8dc4ff0f9
|
| |
|
| |
|
|
|
|
| |
need to increase the refcount on a NULL fd.
|
|
|
|
| |
use it where possible.
|
|
|
|
|
|
| |
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510812090909y11947acfy317e46417b9ae91d@mail.gmail.com>
p4raw-id: //depot/perl@35073
|
|
|
|
|
| |
Message-ID: <20081127070141.GD17663@tytlal.topaz.cx>
p4raw-id: //depot/perl@35018
|
|
|
|
|
|
| |
setting the tests to TODO.
p4raw-link: @34775 on //depot/perl: 2556f95e0f4f5e8e95c9766374614ab52edefe3d
p4raw-id: //depot/perl@34778
|
|
|
|
|
|
|
|
| |
:stdio
From: "Goro Fuji" <gfuji@cpan.org>
Message-ID: <efb9c59b0807061604q476025e9n85893f131a6bf23e@mail.gmail.com>
p4raw-id: //depot/perl@34775
|
|
|
|
|
|
|
|
|
| |
From: "Goro Fuji" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-11257-1211782242-1590.54828-75-0@perl.org>
The second part of the patch. The first part was in change #33978.
p4raw-link: @33978 on //depot/perl: 9d97e8b8cac47626e28c79994e7ab0d5c8589515
p4raw-id: //depot/perl@34774
|
|
|
|
|
|
| |
Message-ID: <25940.1225611819@chthon>
Date: Sun, 02 Nov 2008 01:43:39 -0600
p4raw-id: //depot/perl@34698
|
|
|
|
|
|
| |
Can't easily do gv.h, as GvGP() (at least) needs to split into two
macros - one const for reading, one non-const for writing.
p4raw-id: //depot/perl@34679
|
|
|
|
|
| |
erroneous const in dump.c.
p4raw-id: //depot/perl@34675
|
|
|
|
|
|
|
| |
same FILE * twice, thanks to it calling out to Perl space inside the
close call tree, with the underlying PerlIO * already closed, but not
unlinked.
p4raw-id: //depot/perl@34596
|
|
|
| |
p4raw-id: //depot/perl@34585
|
|
|
|
|
|
|
|
| |
From: "Goro Fuji" (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-11257-1211782242-1590.54828-75-0@perl.org>
First chunk of the patch only
p4raw-id: //depot/perl@33978
|
|
|
| |
p4raw-id: //depot/perl@33671
|