Skip to content

Upload validation with --dry-run still asks for upload to CTAN #264

Open
@muzimuzhi

Description

@muzimuzhi

Originally found in pgf workflow run, see https://github.com/hmenke/pgf/actions/runs/3913264885/jobs/6688947232.

To reproduce,

  • clone l3build repo
  • run l3build ctan
  • run texlua l3build.lua upload --dry-run 1.2.3 and enter dummy announcement, email, and uploader.
    (texlua l3build.lua is used to run the latest, perhaps change-contained l3build.lua in cloned repo instead of the one installed from tex distribution.)

Finally one will get

Validation successful.

The local archive is xx minutes old. <<<--- optional
Do you want to upload to CTAN? [y/n]
> 

Current logic:

  • l3build.lua first loads l3build-upload.lua then l3build-variables.lua.
  • If --dry-run is set, l3build-upload.lua sets ctanupload = false
  • l3build-variables.lua sets ctanupload = ctanupload or "ask"

But, when --dry-run is set hence ctanupload is false, in loading l3build-variables.lua, ctanupload = ctanupload or "ask" will always reset ctanupload to "ask", because both false and nil are false values.

This turns out #247 is not really fixed.

Proposal

diff --git a/l3build-variables.lua b/l3build-variables.lua
index 51f9270..a00d7a1 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -238,4 +238,8 @@ tdsdirs = tdsdirs or {}
 -- Upload settings
 curlexe  = curlexe  or "curl"
 uploadconfig = uploadconfig or {}
-ctanupload   = ctanupload   or "ask"
+-- Skip the case when ctanupload == false.
+-- This happens when --dry-run is passed.
+if ctanupload == nil then
+  ctanupload = "ask"
+end

The inline version ctanupload = ctanupload == nil and ctanupload or "ask" looks less understandable to me, but if that's more in line with Lua conventions...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions