git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Nikos Chantziaras <realnc@gmail.com>,
	git@vger.kernel.org
Subject: Re: git svn log: Use of uninitialized value $sha1_short
Date: Wed, 21 Oct 2020 22:29:01 +0000	[thread overview]
Message-ID: <20201021222901.GK490427@camp.crustytoothpaste.net> (raw)
In-Reply-To: <20201021212917.GA62005@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 2395 bytes --]

On 2020-10-21 at 21:29:17, Jeff King wrote:
> Yeah, I'm almost certain this is the solution, but it was a little
> disturbing that no tests catch it. Besides the warning, it probably is a
> functional problem (I guess that regex is now overly broad since its
> last half is blank). But maybe it doesn't matter much. It looks like
> we're parsing raw diff output from git-log. Short of a really bizarre
> --format parameter, those are the only lines that would match /^:/
> anyway.
> 
> The tests do catch it if we do:
> 
> diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm
> index 3858fcf27d..92e223caed 100644
> --- a/perl/Git/SVN/Log.pm
> +++ b/perl/Git/SVN/Log.pm
> @@ -1,6 +1,6 @@
>  package Git::SVN::Log;
>  use strict;
> -use warnings;
> +use warnings FATAL => qw(all);
>  use Git::SVN::Utils qw(fatal);
>  use Git qw(command
>             command_oneline
> 
> but:
> 
>   - we'd need to do that in each .pm file, as well as git-svn.perl
> 
>   - I wonder if it's suitable for production use (i.e., would it become
>     annoying when a newer version of perl issues a harmless warning;
>     right now that's a minor inconvenience, but aborting the whole
>     program might be a show-stopper).

No, that's not suitable for production use.  Perl does add new warnings
from time to time and breaking things when Perl gets upgraded will
definitely not make us the friends of Linux distros.  Doing this is like
using -Werror: fine for your personal development needs, but not
suitable for shipping to others.

We could run "perl -w" on each file and look for a single-line output
with "OK"; that's what we did at a previous job.  However, any change we
make here needs to be conditional on DEVELOPER, because otherwise anyone
who needs to build an Git with a new version of Perl will potentially
have a broken testsuite.

> It would be nice if we could crank up the severity just while running
> the tests, but I don't think there's an easy built-in way to do that.
> This seems to work:
> 
>   use warnings ($ENV{GIT_PERL_STRICT} ? qw(FATAL all) : ());
> 
> though I'm honestly surprised it does (because "use" is generally
> resolved at read/compile time. I guess perl is smart enough to run
> that code snippet at that point.

Yup, that would run at BEGIN time.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2020-10-21 22:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21 18:42 git svn log: Use of uninitialized value $sha1_short Nikos Chantziaras
2020-10-21 20:26 ` Jeff King
2020-10-21 20:48   ` Junio C Hamano
2020-10-21 21:29     ` Jeff King
2020-10-21 22:29       ` brian m. carlson [this message]
2020-10-22  2:56         ` Jeff King
2020-10-21 22:21     ` brian m. carlson
2020-10-22  1:18 ` [PATCH] svn: use correct variable name for short OID brian m. carlson
2020-10-22  3:00   ` Jeff King
2020-10-22  3:24     ` Jeff King
2020-10-22 19:29       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201021222901.GK490427@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=realnc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).