Skip Menu |
 

This queue is for tickets about the pmtools CPAN distribution.

Report information
The Basics
Id: 124784
Status: open
Priority: 0/
Queue: pmtools

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.2.0
Fixed in: (no value)



Subject: pfcat.t fails on systems with older perl (2.2.0)
Download (untitled) / with headers
text/plain 4.3k
On Debian/wheezy and CentOS6 systems the pfcat.t test fails: # Failed test 'catted module function' # at t/pfcat.t line 19. # '=head1 /usr/share/perl5/pod/perlfunc.pod chunk 1165 # # =item seek FILEHANDLE,POSITION,WHENCE # X<seek> X<fseek> X<filehandle, position> # # Sets FILEHANDLE's position, just like the C<fseek> call of C<stdio>. # FILEHANDLE may be an expression whose value gives the name of the # filehandle. The values for WHENCE are C<0> to set the new position # I<in bytes> to POSITION, C<1> to set it to the current position plus # POSITION, and C<2> to set it to EOF plus POSITION (typically # negative). For WHENCE you may use the constants C<SEEK_SET>, # C<SEEK_CUR>, and C<SEEK_END> (start of the file, current position, end # of the file) from the Fcntl module. Returns C<1> upon success, C<0> # otherwise. # # Note the I<in bytes>: even if the filehandle has been set to # operate on characters (for example by using the C<:encoding(utf8)> open # layer), tell() will return byte offsets, not character offsets # (because implementing that would render seek() and tell() rather slow). # # If you want to position file for C<sysread> or C<syswrite>, don't use # C<seek>--buffering makes its effect on the file's system position # unpredictable and non-portable. Use C<sysseek> instead. # # Due to the rules and rigors of ANSI C, on some systems you have to do a # seek whenever you switch between reading and writing. Amongst other # things, this may have the effect of calling stdio's clearerr(3). # A WHENCE of C<1> (C<SEEK_CUR>) is useful for not moving the file position: # # seek(TEST,0,1); # # This is also useful for applications emulating C<tail -f>. Once you hit # EOF on your read, and then sleep for a while, you might have to stick in a # seek() to reset things. The C<seek> doesn't change the current position, # but it I<does> clear the end-of-file condition on the handle, so that the # next C<< <FILE> >> makes Perl try again to read something. We hope. # # If that doesn't work (some IO implementations are particularly # cantankerous), then you may need something more like this: # # for (;;) { # for ($curpos = tell(FILE); $_ = <FILE>; # $curpos = tell(FILE)) { # # search for some stuff and put it into files # } # sleep($for_a_while); # seek(FILE, $curpos, 0); # } # # =head1 /usr/share/perl5/pod/perlfunc.pod chunk 1174 # # =item seekdir DIRHANDLE,POS # X<seekdir> # # Sets the current position for the C<readdir> routine on DIRHANDLE. POS # must be a value returned by C<telldir>. C<seekdir> also has the same caveats # about possible directory compaction as the corresponding system library # routine. # # =head1 /usr/share/perl5/pod/perlfunc.pod chunk 1551 # # =item sysseek FILEHANDLE,POSITION,WHENCE # X<sysseek> X<lseek> # # Sets FILEHANDLE's system position in bytes using the system call # lseek(2). FILEHANDLE may be an expression whose value gives the name # of the filehandle. The values for WHENCE are C<0> to set the new # position to POSITION, C<1> to set the it to the current position plus # POSITION, and C<2> to set it to EOF plus POSITION (typically # negative). # # Note the I<in bytes>: even if the filehandle has been set to operate # on characters (for example by using the C<:encoding(utf8)> I/O layer), # tell() will return byte offsets, not character offsets (because # implementing that would render sysseek() very slow). # # sysseek() bypasses normal buffered IO, so mixing this with reads (other # than C<sysread>, for example C<< <> >> or read()) C<print>, C<write>, # C<seek>, C<tell>, or C<eof> may cause confusion. # # For WHENCE, you may also use the constants C<SEEK_SET>, C<SEEK_CUR>, # and C<SEEK_END> (start of the file, current position, end of the file) # from the Fcntl module. Use of the constants is also more portable # than relying on 0, 1, and 2. For example to define a "systell" function: # # use Fcntl 'SEEK_CUR'; # sub systell { sysseek($_[0], 0, SEEK_CUR) } # # Returns the new position, or the undefined value on failure. A position # of zero is returned as the string C<"0 but true">; thus C<sysseek> returns # true on success and false on failure, yet you can still easily determine # the new position. # # ' # doesn't match '(?^:There is no .*systell.* function.\s+Use .*sysseek)' # Looks like you failed 1 test of 2. t/pfcat.t ........ Dubious, test returned 1 (wstat 256, 0x100) Failed 1/2 subtests
Download (untitled) / with headers
text/plain 320b
On Thu Mar 15 16:30:13 2018, SREZIC wrote: [...] Show quoted text
> # doesn't match '(?^:There is no .*systell.* function.\s+Use > .*sysseek)' > # Looks like you failed 1 test of 2. > t/pfcat.t ........ > Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/2 subtests
See https://github.com/markleightonfisher/pmtools/pull/5
Download (untitled) / with headers
text/plain 4.9k
On 2018-03-15 16:30:13, SREZIC wrote: Show quoted text
> On Debian/wheezy and CentOS6 systems the pfcat.t test fails: > > # Failed test 'catted module function' > # at t/pfcat.t line 19. > # '=head1 /usr/share/perl5/pod/perlfunc.pod chunk > 1165 > # > # =item seek FILEHANDLE,POSITION,WHENCE > # X<seek> X<fseek> X<filehandle, position> > # > # Sets FILEHANDLE's position, just like the C<fseek> call of C<stdio>. > # FILEHANDLE may be an expression whose value gives the name of the > # filehandle. The values for WHENCE are C<0> to set the new position > # I<in bytes> to POSITION, C<1> to set it to the current position plus > # POSITION, and C<2> to set it to EOF plus POSITION (typically > # negative). For WHENCE you may use the constants C<SEEK_SET>, > # C<SEEK_CUR>, and C<SEEK_END> (start of the file, current position, > end > # of the file) from the Fcntl module. Returns C<1> upon success, C<0> > # otherwise. > # > # Note the I<in bytes>: even if the filehandle has been set to > # operate on characters (for example by using the C<:encoding(utf8)> > open > # layer), tell() will return byte offsets, not character offsets > # (because implementing that would render seek() and tell() rather > slow). > # > # If you want to position file for C<sysread> or C<syswrite>, don't > use > # C<seek>--buffering makes its effect on the file's system position > # unpredictable and non-portable. Use C<sysseek> instead. > # > # Due to the rules and rigors of ANSI C, on some systems you have to > do a > # seek whenever you switch between reading and writing. Amongst other > # things, this may have the effect of calling stdio's clearerr(3). > # A WHENCE of C<1> (C<SEEK_CUR>) is useful for not moving the file > position: > # > # seek(TEST,0,1); > # > # This is also useful for applications emulating C<tail -f>. Once you > hit > # EOF on your read, and then sleep for a while, you might have to > stick in a > # seek() to reset things. The C<seek> doesn't change the current > position, > # but it I<does> clear the end-of-file condition on the handle, so > that the > # next C<< <FILE> >> makes Perl try again to read something. We hope. > # > # If that doesn't work (some IO implementations are particularly > # cantankerous), then you may need something more like this: > # > # for (;;) { > # for ($curpos = tell(FILE); $_ = <FILE>; > # $curpos = tell(FILE)) { > # # search for some stuff and put it into files > # } > # sleep($for_a_while); > # seek(FILE, $curpos, 0); > # } > # > # =head1 /usr/share/perl5/pod/perlfunc.pod chunk 1174 > # > # =item seekdir DIRHANDLE,POS > # X<seekdir> > # > # Sets the current position for the C<readdir> routine on DIRHANDLE. > POS > # must be a value returned by C<telldir>. C<seekdir> also has the > same caveats > # about possible directory compaction as the corresponding system > library > # routine. > # > # =head1 /usr/share/perl5/pod/perlfunc.pod chunk 1551 > # > # =item sysseek FILEHANDLE,POSITION,WHENCE > # X<sysseek> X<lseek> > # > # Sets FILEHANDLE's system position in bytes using the system call > # lseek(2). FILEHANDLE may be an expression whose value gives the > name > # of the filehandle. The values for WHENCE are C<0> to set the new > # position to POSITION, C<1> to set the it to the current position > plus > # POSITION, and C<2> to set it to EOF plus POSITION (typically > # negative). > # > # Note the I<in bytes>: even if the filehandle has been set to operate > # on characters (for example by using the C<:encoding(utf8)> I/O > layer), > # tell() will return byte offsets, not character offsets (because > # implementing that would render sysseek() very slow). > # > # sysseek() bypasses normal buffered IO, so mixing this with reads > (other > # than C<sysread>, for example C<< <> >> or read()) C<print>, > C<write>, > # C<seek>, C<tell>, or C<eof> may cause confusion. > # > # For WHENCE, you may also use the constants C<SEEK_SET>, C<SEEK_CUR>, > # and C<SEEK_END> (start of the file, current position, end of the > file) > # from the Fcntl module. Use of the constants is also more portable > # than relying on 0, 1, and 2. For example to define a "systell" > function: > # > # use Fcntl 'SEEK_CUR'; > # sub systell { sysseek($_[0], 0, SEEK_CUR) } > # > # Returns the new position, or the undefined value on failure. A > position > # of zero is returned as the string C<"0 but true">; thus C<sysseek> > returns > # true on success and false on failure, yet you can still easily > determine > # the new position. > # > # ' > # doesn't match '(?^:There is no .*systell.* function.\s+Use > .*sysseek)' > # Looks like you failed 1 test of 2. > t/pfcat.t ........ > Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/2 subtests
In the meantime, it fails now also with newer perls. It seems that the systell+sysseek sentence is now spread across two lines: ... # There is no C<systell> function. Use # L<C<sysseek($fh, 0, 1)>|/sysseek FILEHANDLE,POSITION,WHENCE> for that. ...


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.