Skip to content

Conversation

xatier
Copy link

@xatier xatier commented May 5, 2014

I removed some trailing whitespaces with the following shell commands.

find . -name "*.c" | xargs egrep -l " +$"
find . -name "*.cpp" | xargs egrep -l " +$"
find . -name "*.h" | xargs egrep -l " +$"

@seveas
Copy link
Contributor

seveas commented May 5, 2014

Perl doesn't use pull requests, patches should be filed using perlbug. Trailing whitespace removal is also not considered important, but merely noise...

@xatier
Copy link
Author

xatier commented May 5, 2014

I think lots of whitespaces bring bad code quality to the Perl source code...

@seveas
Copy link
Contributor

seveas commented May 5, 2014

Trailing whitespace has nothing to do with quality...

@thaljef
Copy link

thaljef commented May 5, 2014

Thank you very much for the patch, @xatier. This GitHub repository is just a mirror of the main repository at http://perl5.git.perl.org. But some folks like to clone from GitHub because it has a fast content delivery network.

As @seveas said, patches for Perl can be submitted with perlbug. perlbug is a utility program that has helped the Perl community manage contributions for many years (long before GitHub ever existed).

I don't know if the Perl5 Porters have a policy about trailing whitespace. But I share your feelings -- code that looks good tends to run good [sic]. I'm sure the Porters would be happy to consider your patch.

p5p pushed a commit that referenced this pull request Nov 7, 2014
In the op tree, a statement consists of a nextstate/dbstate op (of
class cop) followed by the contents of the statement.  This cop is
created after the statement has been parsed.  So if you have nested
statements, the outermost statement has the highest sequence number
(cop_seq).  Every sub (including BEGIN blocks) has a sequence number
indicating where it occurs in its containing sub.

So

 BEGIN { } #1
 # seq 2
 {
   # seq 1
   ...
 }

is indistinguishable from

 # seq 2
 {
   BEGIN { } #1
   # seq 1
   ...
 }

because the sequence number of the BEGIN block is 1 in both examples.

By reserving a sequence number at the start of every block and using
it once the block has finished parsing, we can do this:

 BEGIN { } #1
 # seq 1
 {
   # seq 2
   ...
 }

 # seq 1
 {
   BEGIN { } #2
   # seq 2
   ...
 }

and now B::Deparse can tell where to put the blocks.

PL_compiling.cop_seq was unused, so this is where I am stashing
the pending sequence number.
@rjbs rjbs closed this Feb 26, 2015
p5p pushed a commit that referenced this pull request Dec 3, 2016
  [DELTA]

1.25     2016-11-17

- Reduce memory usage by only loading Config if needed and not importing from
  Carp. Based on PR #2 from J. Nick Coston.
p5p pushed a commit that referenced this pull request Jan 12, 2017
  [DELTA]

1.25     2016-11-17

- Reduce memory usage by only loading Config if needed and not importing from
  Carp. Based on PR #2 from J. Nick Coston.
p5p pushed a commit that referenced this pull request Feb 14, 2017
At this maximal level of debugging output, it displays the top 3 state
stack entries each time it pushes, but with no obvious indication that
a push is occurring. This commit changes this output:

                             |   1|  Setting an EVAL scope, savestack=9,
                             |   2|   #4   WHILEM_A_max
                             |   2|   #3   WHILEM_A_max
                             |   2|   #2   CURLYX_end yes
   0 <abcdef> <g>            |   2|   4:POSIXD[\w](5)

to be this (which includes the word "push" and extra indentation for the
stack dump):

                             |   1|  Setting an EVAL scope, savestack=9,
                             |   2|   push #4   WHILEM_A_max
                             |   2|        #3   WHILEM_A_max
                             |   2|        #2   CURLYX_end yes
   0 <abcdef> <g>            |   2|   4:POSIXD[\w](5)

Also, replace curd (current depth) var with a positive integer offset
(i) var, to avoid signed/unsigned mixing problems.
p5p pushed a commit that referenced this pull request Jun 16, 2017
  [DELTA]

1.57 2017-01-22 rurban
----
  * Todo the t/exec.t test 2 on cygwin.
  * Fixed/Todo the t/decrypt.t test 7 utf8 failures.
    Skip with non UTF-8 locale.

1.56 2017-01-20 rurban
----

  * add binmode to the decrypt/encr,decrypt sample scripts
  * add utf8-encoded testcase to t/decrypt.t [cpan #110921]. use -C
  * stabilized some tests, add diag to sometimes failing sh tests
  * moved filter-util.pl to t/
  * fixed INSTALLDIRS back to site since 5.12 [gh #2]
  * fixed exec/sh test races using the same temp. filenames
  * reversed this Changes file to latest first
  * added Travis CI
p5p pushed a commit that referenced this pull request Oct 26, 2017
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Nov 23, 2017
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Dec 4, 2017
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Jan 10, 2018
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Jan 15, 2018
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Feb 8, 2018
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Apr 19, 2018
detected by coverity:
CID 165606 (#2 of 2): Untrusted value as argument (TAINTED_SCALAR)
146. tainted_data: Passing tainted variable size to a tainted sink.

(cherry picked from commit 735d922)

Conflicts:
	dist/Storable/Storable.pm
p5p pushed a commit that referenced this pull request Apr 19, 2019
Commit v5.27.8-405-gf548aeca98 from a year ago tweaked this
timing-sensitive test script to reduce false positives.
However, we're still seeing the occasional failure of test 2 in smokes,
so twaks the timing a little further.
khwilliamson pushed a commit to khwilliamson/perl5 that referenced this pull request Jan 30, 2023
Fixed the issue with warning
mauke added a commit to mauke/perl5 that referenced this pull request Feb 8, 2024
On some platforms, building a -DDEBUGGING perl triggers the following
compiler warnings:

    In file included from locale.c:385:
    locale.c: In function ‘S_bool_setlocale_2008_i’:
    locale.c:2494:29: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘int’ [-Wformat=]
                                 "bool_setlocale_2008_i: creating new object"    \
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    perl.h:4983:33: note: in definition of macro ‘DEBUG__’
                     DEBUG_PRE_STMTS a; DEBUG_POST_STMTS                     \
                                     ^
    locale.c:2493:7: note: in expansion of macro ‘DEBUG_L’
           DEBUG_L(PerlIO_printf(Perl_debug_log,                                 \
           ^~~~~~~
    locale.c:2523:17: note: in expansion of macro ‘DEBUG_NEW_OBJECT_FAILED’
                     DEBUG_NEW_OBJECT_FAILED(category_names[index], new_locale,
                     ^~~~~~~~~~~~~~~~~~~~~~~
    In file included from locale.c:322:
    config.h:4052:18: note: format string is defined here
     #define U32uf  "lu"  /**/

This is because the code tries to format __LINE__ with a varargs
function using %"LINE_Tf".

Things are slightly tricky here because in a varargs function, no type
context is available, so the format string absolutely has to match the
intrinsic type of each argument. The __LINE__ macro expands to a simple
(decimal) integer constant. According to C, such a constant has type int
if its value fits, otherwise unsigned int if it fits, otherwise long
int, etc. None of the *.c files in the perl distribution exceed 32767
lines (the minimum INT_MAX required by C), so even on ancient 16-bit
systems, our __LINE__ will always be of type int.

The %"LINE_Tf" format is designed to match a line_t argument, not int.
(On some platforms, line_t is defined as unsigned long and incompatible
with int for formatting purposes.) Therefore it is an error to use
%"LINE_Tf" with __LINE__.

One way to fix this is to convert the argument to match the format
string: ... %"LINE_Tf" ...", (line_t)__LINE__.

The other way is to change the format string to match the (int)
argument: "... %d ...", __LINE__.

I chose option Perl#2 because it is by far the most common way to output
__LINE__ elsewhere in the perl source.
mauke added a commit that referenced this pull request Aug 26, 2024
1.41      2024-08-25 22:32:19Z
  - fix leaks in @thread_object_registry (RT#64025, tusooa, #1 and Lukas Mai, #2)
  - fix incompatibility with Scalar::Util 1.65 and remove old refaddr fallback
    (Lukas Mai, #3)
rawleyfowler pushed a commit to rawleyfowler/perl5 that referenced this pull request Sep 2, 2024
1.41      2024-08-25 22:32:19Z
  - fix leaks in @thread_object_registry (RT#64025, tusooa, Perl#1 and Lukas Mai, Perl#2)
  - fix incompatibility with Scalar::Util 1.65 and remove old refaddr fallback
    (Lukas Mai, Perl#3)
iabyn added a commit that referenced this pull request Apr 24, 2025
This is #2 of a small series of commits to refactor the INPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, INPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an INPUT section.
iabyn added a commit that referenced this pull request Apr 24, 2025
This is #2 of a small series of commits to refactor the OUTPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, OUTPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an OUTPUT section.
iabyn added a commit that referenced this pull request May 26, 2025
This is #2 of a small series of commits to refactor the INPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, INPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an INPUT section.
iabyn added a commit that referenced this pull request May 26, 2025
This is #2 of a small series of commits to refactor the OUTPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, OUTPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an OUTPUT section.
iabyn added a commit that referenced this pull request Jul 6, 2025
This is #2 of a small series of commits to refactor the INPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, INPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an INPUT section.
iabyn added a commit that referenced this pull request Jul 6, 2025
This is #2 of a small series of commits to refactor the OUTPUT_handler()
method and turn it into a Node subclass method.

This commit splits the method into two: a smaller outer one which
has the 'foreach line' loop, and a new method, OUTPUT_handler_line()
which contains the bulk of the old method and processes a single line
from an OUTPUT section.
mauke added a commit to mauke/perl5 that referenced this pull request Jul 21, 2025
... such as SvCUR(*tmp) and SvUTF(*tmp).

Fixes Coverity ID 582459: Evaluation order violation (EVALUATION_ORDER)

> read_write_order: In argument Perl#3 of `Perl_pv_pretty(my_perl, sv, (char const *)Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U), *({...; &((XPV *)({...; p_;}))->xpv_cur;}), colwidth, my_perl->Icolors[0], my_perl->Icolors[1], (((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800)`, a call is made to `Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U)`. In argument Perl#2 of this function, the object `(*tmp)->sv_flags` is modified. This object is also used in `(((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800`, the argument Perl#8 of the outer function call. The order in which these arguments are evaluated is not specified, and will vary between platforms.
mauke added a commit to mauke/perl5 that referenced this pull request Jul 21, 2025
... such as SvCUR(*tmp) and SvUTF8(*tmp).

Fixes Coverity ID 582459: Evaluation order violation (EVALUATION_ORDER)

> read_write_order: In argument Perl#3 of `Perl_pv_pretty(my_perl, sv, (char const *)Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U), *({...; &((XPV *)({...; p_;}))->xpv_cur;}), colwidth, my_perl->Icolors[0], my_perl->Icolors[1], (((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800)`, a call is made to `Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U)`. In argument Perl#2 of this function, the object `(*tmp)->sv_flags` is modified. This object is also used in `(((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800`, the argument Perl#8 of the outer function call. The order in which these arguments are evaluated is not specified, and will vary between platforms.
mauke added a commit that referenced this pull request Jul 23, 2025
... such as SvCUR(*tmp) and SvUTF8(*tmp).

Fixes Coverity ID 582459: Evaluation order violation (EVALUATION_ORDER)

> read_write_order: In argument #3 of `Perl_pv_pretty(my_perl, sv, (char const *)Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U), *({...; &((XPV *)({...; p_;}))->xpv_cur;}), colwidth, my_perl->Icolors[0], my_perl->Icolors[1], (((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800)`, a call is made to `Perl_SvPV_helper(my_perl, *tmp, NULL, 2U, SvPVnormal_type_, Perl_sv_2pv_flags, false, 32U)`. In argument #2 of this function, the object `(*tmp)->sv_flags` is modified. This object is also used in `(((*tmp)->sv_flags & 0x20000000U) ? 256 : 0) | 0x800`, the argument #8 of the outer function call. The order in which these arguments are evaluated is not specified, and will vary between platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants