From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: * X-Spam-Status: No, score=1.4 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 6147 invoked from network); 3 Sep 2022 21:25:57 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2022 21:25:57 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 6ee2321e for ; Sat, 3 Sep 2022 16:25:52 -0500 (EST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id 36852c1d for ; Sat, 3 Sep 2022 16:25:51 -0500 (EST) Received: by mail-pl1-f173.google.com with SMTP id l3so5080535plb.10 for ; Sat, 03 Sep 2022 14:25:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date; bh=mPSp+q3NhBQ7h7vvH8EnpxBtEggnB8QfXIhc/XNIYHk=; b=fhAqi4oz8zNSuhIadItPuAD3P6CWNu+OFZfzXHXAcraiUIrodYQPYlt8/ZQXBHInPL w5E5ApheNbK7SW9L8H/vjepETkmMc3zMKzWW+QS1HEJViukAap3WQvEYTiVpsRyBj2ZN tuZdm0b1o1rvYrc2UU4BISl/MAv5uRn06gFnX5a5Sd6WZub2+16i3wqh61Eny2iLLVwN IhvjSYXGkZLGSYbbwYKIpx6h9kz1Plw9nWxv81QzYj4OpKRwjHsmVIEtUvoIKsREE67o AfMHOx6Ar3asNA77OhU8CrnZkWwNZKn23rRx+AJDX2h1QvDuY8iqCHk56nwqdLqsRJKh 1KXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=mPSp+q3NhBQ7h7vvH8EnpxBtEggnB8QfXIhc/XNIYHk=; b=KrrV5wUZJDQ/SxO5zK5MD6cYlN3f+hyFOu1bg/ndTdkQOadLo8NSyCAa1uQ7mFU7U6 0TkyH+yIYFS+T5KLhdV0E8AN/f3RBM5Hj5PmLAGS60375A0+rMpCdg6F/wyq+OGdoC5t /VIZSO8+IOJT1IY+8+C2mU7dB0Z/hsJK9hm3w1aJ3oD+xDNvh2LkHbIk3xpWdSsRM6oI BUNOx1kKs9BDfyTBdnjeDBbUYx4BAtcHvX4PGOItRbuMmG1KWFowS3m6BqPnWI4y3bT/ x+Y3k+Etcmd6UScuzAWyM+iH4yq4gemAG7+Kxy70sdIXnSuc7kWK2gKzZWE6lyDhEKQ+ CVXA== X-Gm-Message-State: ACgBeo2ssOtQUoF/qekFzCN7D3FEcQOEQ+BLcfpNjDag7S7g7AKHnkWn Fqri/diuEQoP5ZmegOREXQohI3VKCUU= X-Google-Smtp-Source: AA6agR6i/p2i9Y4G7qiytGFBYRMVrcLvMIl7v3y9fNDJP6NybjBSAE6jqlBCLmsm5DDXwbeRVv3bJQ== X-Received: by 2002:a17:90b:3d01:b0:1fe:682:6517 with SMTP id pt1-20020a17090b3d0100b001fe06826517mr11874217pjb.215.1662240350361; Sat, 03 Sep 2022 14:25:50 -0700 (PDT) Received: from pine.sigxcpu.com ([2601:601:9d82:76e0::68e9]) by smtp.gmail.com with ESMTPSA id i29-20020aa796fd000000b0053624c50d74sm4379081pfq.126.2022.09.03.14.25.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Sep 2022 14:25:50 -0700 (PDT) Date: Sat, 3 Sep 2022 14:25:48 -0700 From: Simon Branch To: discuss@mandoc.bsd.lv Subject: Gzip'ed manpages other than the first argument Message-ID: <20220903212548.yefzvlxm56cegeiw@pine.sigxcpu.com> X-Mailinglist: mandoc-discuss Reply-To: discuss@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello! A current build of mandoc(1) only automatically unzips on the first call to process_onefile(). This is because detection happens in mparse_open(), which is called by process_onefile() *before* parse(): if (resp->file != NULL) if ((fd = mparse_open(mp, resp->file)) == -1) ... ... if (resp->form == FORM_SRC) parse(mp, fd, resp->file, outst, conf); Unfortunately parse() is where we reset the struct mparse if (previous) mparse_reset(mp); else previous = 1; ... which is where the gzip flag is stored. In other words, process_onefile() calls mparse_open(), which populates mp->gzip, and then calls parse(), which overwrites mp->gzip (after the first run). My fix here is to hoist the mparse_reset() call all the way out to main(), where it is within view of the initial mparse_alloc(). Thoughts? Index: main.c =================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.361 diff -u -r1.361 main.c --- main.c 14 Apr 2022 16:43:43 -0000 1.361 +++ main.c 3 Sep 2022 20:34:10 -0000 @@ -626,6 +626,8 @@ */ startdir = open(".", O_RDONLY | O_DIRECTORY); for (i = 0; i < ressz; i++) { + if (i) + mparse_reset(mp); process_onefile(mp, res + i, startdir, &outst, &conf); if (outst.wstop && mandoc_msg_getrc() != MANDOCLEVEL_OK) break; @@ -952,17 +954,11 @@ struct outstate *outst, struct manconf *conf) { static struct manpaths basepaths; - static int previous; struct roff_meta *meta; assert(fd >= 0); if (file == NULL) file = ""; - - if (previous) - mparse_reset(mp); - else - previous = 1; mparse_readfd(mp, fd, file); if (fd != STDIN_FILENO) -- To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv