public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, devel@edk2.groups.io
Cc: Antoine Coeur <coeur@gmx.fr>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH 58/79] OvmfPkg/Qemu: Fix various typos
Date: Mon, 9 Dec 2019 17:12:03 +0100	[thread overview]
Message-ID: <4dab8f85-5ef3-dc72-44de-eeda7778119b@redhat.com> (raw)
In-Reply-To: <391a6f7b-ba08-eb43-a6b6-2615437435c2@redhat.com>

On 12/09/19 14:00, Philippe Mathieu-Daudé wrote:

> I forgot, to have VbeShim.sh succeed, I also have this local change:
>
> -- >8 --
> diff --git a/OvmfPkg/QemuVideoDxe/VbeShim.sh
> b/OvmfPkg/QemuVideoDxe/VbeShim.sh
> index aea28be35f5c..92b345befe1f 100755
> --- a/OvmfPkg/QemuVideoDxe/VbeShim.sh
> +++ b/OvmfPkg/QemuVideoDxe/VbeShim.sh
> @@ -28,7 +28,7 @@ trap exit_handler EXIT
>  #
>  # Assemble the source file.
>  #
> -nasm -o "$STEM".bin -- "$STEM".asm
> +nasm -fbin "$STEM".asm -o "$STEM".bin
>
>  #
>  # Disassemble it, in order to get a binary dump associated with the
> source.
> ---
>
> Because I had this error:
>
> $ sh -x OvmfPkg/QemuVideoDxe/VbeShim.sh
> [...]
> ++ dirname -- OvmfPkg/QemuVideoDxe/VbeShim.sh
> ++ basename -- OvmfPkg/QemuVideoDxe/VbeShim.sh .sh
> + STEM=OvmfPkg/QemuVideoDxe/VbeShim
> + trap exit_handler EXIT
> + nasm -o OvmfPkg/QemuVideoDxe/VbeShim.bin --
> OvmfPkg/QemuVideoDxe/VbeShim.asm
> nasm: error: more than one input file specified
> nasm: error: more than one input file specified
> nasm: error: more than one input file specified
> type `nasm -h' for help
> + exit_handler
>
> Which is rather confuse, because the help is still recommending the
> current form:
>
> $ nasm -h
> usage: nasm [-@ response file] [-o outfile] [-f format] [-l listfile]
>             [options...] [--] filename
>     or nasm -v (or --v) for version info
>
>     -t          assemble in SciTech TASM compatible mode
>     -E (or -e)  preprocess only (writes output to stdout by default)
>     -a          don't preprocess (assemble only)
>     -M          generate Makefile dependencies on stdout
>     -MG         d:o, missing files assumed generated
>     -MF <file>  set Makefile dependency file
>     -MD <file>  assemble and generate dependencies
>     -MT <file>  dependency target name
>     -MQ <file>  dependency target name (quoted)
>     -MP         emit phony target
>
>     -Z<file>    redirect error messages to file
>     -s          redirect error messages to stdout
>
>     -g          generate debugging information
>
>     -F format   select a debugging format
>
>     -gformat    same as -g -F format
>
>     -o outfile  write output to an outfile
>
>     -f format   select an output format
>
>     -l listfile write listing to a listfile
>
>     -I<path>    adds a pathname to the include file path
>     -O<digit>   optimize branch offsets
>                 -O0: No optimization
>                 -O1: Minimal optimization
>                 -Ox: Multipass optimization (default)
>
>     -P<file>    pre-includes a file
>     -D<macro>[=<value>] pre-defines a macro
>     -U<macro>   undefines a macro
>     -X<format>  specifies error reporting format (gnu or vc)
>     -w+foo      enables warning foo (equiv. -Wfoo)
>     -w-foo      disable warning foo (equiv. -Wno-foo)
>
>     -w[+-]error[=foo] can be used to promote warnings to errors
>     -h           show invocation summary and exit
>
> --prefix,--postfix
>                 these options prepend or append the given string
>                 to all extern and global variables
>

Yeah I think this is a NASM regression. In my version of NASM
(nasm-2.10.07-7.el7.x86_64, on RHEL7), the manual says, near "-f":

> To see a list of valid output formats, use the -hf option.

And when I invoke NASM like that, I get:

> valid output formats for -f are (`*' denotes default):
>   * bin       flat-form binary files (e.g. DOS .COM, .SYS)

So NASM either removed any default for "-f", or changed the default. Let
me check...

At upstream commit e91f5cc1322e ("preproc: fix %undef of macro aliases,
and add %ifdefalias", 2019-10-23), the source file "output/outform.h"
still contains:

> #ifndef OF_DEFAULT
> #define OF_DEFAULT of_bin
> #endif

This can be overridden when building NASM:

>  * Default config = -DOF_ALL -DOF_DEFAULT=of_bin

However, if I check Fedora dist-git at commit 0150c8afb52f ("Rebuilt for
Python 3.8", 2019-08-19) (the HEAD of the f30 branch), then I do *not*
see any OF_DEFAULT mentions.

...

NASM in Fedora 30 seems to be based on 2.14.02. Upstream tag "nasm-2.14"
contains commit 987dc9c9dbe3 ("Make any execution limit configurable,
add eval limit", 2018-06-12). This commit seems to have changed how the
"--" options-terminator is processed:

> @@ -1068,25 +1062,61 @@ static bool process_arg(char *p, char *q, int pass)
>          case '-':
>              {
>                  const struct textargs *tx;
> +                size_t olen, plen;
>
> -                if (p[2] == 0) {        /* -- => stop processing options */
> +                p += 2;
> +
> +                if (!*p) {        /* -- => stop processing options */
>                      stopoptions = true;
>                      break;
>                  }

I don't know if this is actually the problem, it just looks related. Can
you report a bug in the upstream tracker? <https://bugzilla.nasm.us/>

If NASM upstream confirms the bug, then I'd like to request that you
please submit this patch for "OvmfPkg/QemuVideoDxe/VbeShim.sh",
including a comment to the upstream NASM bug report.


To be clear, the original -- now apparently broken -- NASM command line
follows the "Utility Syntax Guidelines" from POSIX:

  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02

See in particular Guideline 9 ("All options should precede operands on
the command line") and Guideline 10 ("The first '--' argument that is
not an option-argument should be accepted as a delimiter indicating the
end of options"). Namely:

* '-o "$STEM".bin' is an option, taking an option-argument. Therefore it
  should go first.

* The argument '--' is the end-of-options delimiter, which is generally
  recommended every time an operand is substituted. (For example, if we
  want to delete "$HELLO", we don't just write 'rm -rf "$HELLO"', but
  "rm -rf -- "$HELLO".)

* The argument '"$STEM".asm' is an operand.


The command line that your patch adds:

- breaks Guideline 9, because it intermixes options and operands;

- breaks Guideline 6, because it contracts "-f" with "bin" into a single
  argument, even though "-f" takes a mandatory -- i.e. not optional --
  option-argument (such as "bin"). Per guideline 6, if an option
  requires a mandatory option-argument, then the option itself, and its
  argument, should be separate arguments.

I don't meant that your patch is wrong -- I mean that NASM could be
wrong to require us to use this syntax. Hence my request to file a bug
report for upstream NASM first.

Thank you!
Laszlo


  reply	other threads:[~2019-12-09 16:12 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 16:14 [PATCH 00/79] Fix a bunch of typos (part 1) Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 01/79] CryptoPkg/OpensslLib: Fix few typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 02/79] EmbeddedPkg/FdtLib: Fix a typo Philippe Mathieu-Daudé
2019-12-03 16:58   ` Leif Lindholm
2019-12-03 16:14 ` [PATCH 03/79] EmbeddedPkg/VirtualKeyboard: Fix a typo in EFI_INVALID_PARAMETER Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 04/79] EmbeddedPkg/VirtualKeyboard: Fix few typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 05/79] EmulatorPkg/Sec: Fix various typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 06/79] EmulatorPkg/Unix: " Philippe Mathieu-Daudé
2019-12-20  6:38   ` Ni, Ray
2019-12-03 16:14 ` [PATCH 07/79] EmulatorPkg/Win: " Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 08/79] FatPkg/EnhancedFatDxe: " Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 09/79] FatPkg/FatPei: Fix few typos Philippe Mathieu-Daudé
2019-12-20  6:37   ` Ni, Ray
2019-12-03 16:14 ` [PATCH 10/79] IntelFsp2WrapperPkg: Fix various typos Philippe Mathieu-Daudé
2019-12-04  1:14   ` [edk2-devel] " Nate DeSimone
2019-12-04  1:22   ` Chiu, Chasel
2019-12-04  1:40     ` [edk2-devel] " Michael D Kinney
2019-12-04  2:30   ` Zeng, Star
2019-12-11  1:53   ` Chiu, Chasel
2019-12-03 16:14 ` [PATCH 11/79] MdeModulePkg/Application: Improve French translation Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 12/79] MdeModulePkg/Application: Fix various typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 13/79] MdeModulePkg/Bus/Ata: " Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 14/79] MdeModulePkg/Bus/I2c: Fix few typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 15/79] MdeModulePkg/Bus/Isa: Fix various typos Philippe Mathieu-Daudé
2019-12-03 16:14 ` [PATCH 16/79] MdeModulePkg/Bus/Scsi: " Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 17/79] MdeModulePkg/Bus/Sd: " Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 18/79] MdeModulePkg/Core/Pei: " Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 19/79] MdeModulePkg/Core/PiSmmCore: " Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 20/79] MdeModulePkg/UsbBusDxe: Fix a typo Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 21/79] MdeModulePkg/UsbMass: Fix various typos Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 22/79] MdeModulePkg/UsbMouse: Fix few typos Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 23/79] MdeModulePkg/UsbBus: Fix various typos Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 24/79] MdeModulePkg/Usb: " Philippe Mathieu-Daudé
2019-12-03 16:15 ` [PATCH 25/79] MdePkg/IndustryStandard: " Philippe Mathieu-Daudé
2019-12-04  1:35   ` Michael D Kinney
2019-12-03 16:15 ` [PATCH 26/79] MdePkg/Library/Dxe: " Philippe Mathieu-Daudé
2019-12-04  1:24   ` [edk2-devel] " Michael D Kinney
2019-12-03 16:15 ` [PATCH 27/79] MdePkg/Library/Pci: " Philippe Mathieu-Daudé
2019-12-04  1:25   ` [edk2-devel] " Michael D Kinney
2019-12-03 16:15 ` [PATCH 28/79] MdePkg/Library/Smm: " Philippe Mathieu-Daudé
2019-12-04  1:28   ` Michael D Kinney
2019-12-03 16:15 ` [PATCH 29/79] MdePkg/Ppi: " Philippe Mathieu-Daudé
2019-12-04  1:29   ` [edk2-devel] " Michael D Kinney
2019-12-03 16:15 ` [PATCH 30/79] MdePkg/Register: " Philippe Mathieu-Daudé
2019-12-04  1:30   ` [edk2-devel] " Michael D Kinney
2019-12-03 16:15 ` [PATCH 31/79] NetworkPkg: Fix a typo Philippe Mathieu-Daudé
2019-12-03 17:18   ` Leif Lindholm
2019-12-03 17:20     ` Philippe Mathieu-Daudé
2019-12-04 14:02       ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 32/79] NetworkPkg/ArpDxe: Fix various typos Philippe Mathieu-Daudé
2019-12-04 13:20   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 33/79] NetworkPkg/Dhcp4Dxe: " Philippe Mathieu-Daudé
2019-12-04 13:25   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 34/79] NetworkPkg/Dhcp6Dxe: " Philippe Mathieu-Daudé
2019-12-04 13:28   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 35/79] NetworkPkg/DnsDxe: Fix a typo Philippe Mathieu-Daudé
2019-12-04 13:35   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 36/79] NetworkPkg/DnsDxe: Fix various typos Philippe Mathieu-Daudé
2019-12-04 13:36   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 37/79] NetworkPkg/DpcDxe: Fix few typos Philippe Mathieu-Daudé
2019-12-04 13:37   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 38/79] NetworkPkg/HttpBootDxe: Fix a typo in variable name Philippe Mathieu-Daudé
2019-12-04 13:52   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:15 ` [PATCH 39/79] NetworkPkg/HttpBootDxe: Fix various typos Philippe Mathieu-Daudé
2019-12-04 13:53   ` [edk2-devel] " Maciej Rabeda
2019-12-03 16:26 ` [PATCH 00/79] Fix a bunch of typos (part 1) Cœur
     [not found] ` <20191203161602.15969-61-philmd@redhat.com>
2019-12-03 16:45   ` [PATCH 60/79] OvmfPkg/Xen: Fix a typo Anthony PERARD
2019-12-03 21:05   ` Laszlo Ersek
     [not found] ` <20191203161602.15969-62-philmd@redhat.com>
2019-12-03 16:56   ` [PATCH 61/79] OvmfPkg/Xen: Fix various typos Anthony PERARD
2019-12-03 21:06     ` Laszlo Ersek
2019-12-04  3:39     ` Cœur
2019-12-04 16:07       ` [edk2-devel] " Michael D Kinney
2019-12-09 13:06         ` Philippe Mathieu-Daudé
2019-12-09 17:53           ` Michael D Kinney
     [not found] ` <20191203161602.15969-76-philmd@redhat.com>
2019-12-03 19:44   ` [PATCH 75/79] StandaloneMmPkg: Fix a typo Yao, Jiewen
     [not found] ` <20191203161602.15969-77-philmd@redhat.com>
2019-12-03 19:45   ` [PATCH 76/79] StandaloneMmPkg: Fix few typos Yao, Jiewen
     [not found] ` <20191203161602.15969-57-philmd@redhat.com>
2019-12-03 20:48   ` [PATCH 56/79] OvmfPkg/Acpi: " Laszlo Ersek
     [not found] ` <20191203161602.15969-58-philmd@redhat.com>
2019-12-03 20:50   ` [PATCH 57/79] OvmfPkg/Csm: Fix various typos Laszlo Ersek
2019-12-03 23:31     ` David Woodhouse
2019-12-04 14:07       ` [edk2-devel] " Philippe Mathieu-Daudé
     [not found] ` <20191203161602.15969-59-philmd@redhat.com>
2019-12-03 21:00   ` [PATCH 58/79] OvmfPkg/Qemu: " Laszlo Ersek
2019-12-09 12:55     ` Philippe Mathieu-Daudé
2019-12-09 13:00       ` Philippe Mathieu-Daudé
2019-12-09 16:12         ` Laszlo Ersek [this message]
2019-12-09 15:44       ` Laszlo Ersek
     [not found] ` <20191203161602.15969-60-philmd@redhat.com>
2019-12-03 21:00   ` [PATCH 59/79] OvmfPkg/Virtio: Fix few typos Laszlo Ersek
     [not found] ` <20191203161602.15969-80-philmd@redhat.com>
2019-12-03 21:05   ` [PATCH 79/79] UefiCpuPkg/Smm: Fix various typos Laszlo Ersek
2019-12-06  7:24   ` Dong, Eric
     [not found] ` <20191203161602.15969-73-philmd@redhat.com>
2019-12-04  1:03   ` [PATCH 72/79] SourceLevelDebugPkg/DebugAgent: " Wu, Hao A
     [not found] ` <20191203161602.15969-74-philmd@redhat.com>
2019-12-04  1:03   ` [PATCH 73/79] SourceLevelDebugPkg/DebugCommunicationLib: " Wu, Hao A
     [not found] ` <20191203161602.15969-75-philmd@redhat.com>
2019-12-04  1:03   ` [PATCH 74/79] SourceLevelDebugPkg: Fix few typos Wu, Hao A
2019-12-04  1:16 ` [edk2-devel] [PATCH 00/79] Fix a bunch of typos (part 1) Nate DeSimone
2019-12-04  1:27   ` Liming Gao
2019-12-04  9:09     ` Laszlo Ersek
2019-12-04 14:57       ` Maciej Rabeda
2019-12-04 16:29   ` Philippe Mathieu-Daudé
2019-12-04 16:44     ` Leif Lindholm
2019-12-04 22:15       ` Laszlo Ersek
2019-12-04 22:18         ` Philippe Mathieu-Daudé
     [not found] ` <20191203161602.15969-78-philmd@redhat.com>
2019-12-03 21:03   ` [PATCH 77/79] UefiCpuPkg/CpuDxe: Fix few typos Laszlo Ersek
2019-12-06  7:24   ` Dong, Eric
     [not found] ` <20191203161602.15969-79-philmd@redhat.com>
2019-12-03 21:04   ` [PATCH 78/79] UefiCpuPkg/PiSmm: Fix various typos Laszlo Ersek
2019-12-06  7:24   ` Dong, Eric
     [not found] ` <20191203161602.15969-56-philmd@redhat.com>
2019-12-06 16:01   ` [PATCH 55/79] NetworkPkg/VlanConfigDxe: Fix few typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-55-philmd@redhat.com>
2019-12-06 16:01   ` [PATCH 54/79] NetworkPkg/UefiPxeBcDxe: Fix various typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-52-philmd@redhat.com>
2019-12-06 16:01   ` [PATCH 51/79] NetworkPkg/Tls: Fix few typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-51-philmd@redhat.com>
2019-12-06 16:02   ` [PATCH 50/79] NetworkPkg/TcpDxe/Tcp: Fix various typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-47-philmd@redhat.com>
2019-12-06 16:02   ` [PATCH 46/79] NetworkPkg/Mtftp4Dxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-53-philmd@redhat.com>
2019-12-06 16:02   ` [PATCH 52/79] NetworkPkg/Udp4Dxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-54-philmd@redhat.com>
2019-12-06 16:03   ` [PATCH 53/79] NetworkPkg/Udp6Dxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-43-philmd@redhat.com>
2019-12-06 16:03   ` [PATCH 42/79] NetworkPkg/Ip6Dxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-45-philmd@redhat.com>
2019-12-06 16:04   ` [PATCH 44/79] NetworkPkg/Library: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-42-philmd@redhat.com>
2019-12-06 16:04   ` [PATCH 41/79] NetworkPkg/Ip4Dxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-50-philmd@redhat.com>
2019-12-06 16:04   ` [PATCH 49/79] NetworkPkg/TcpDxe/Sock: Fix few typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-48-philmd@redhat.com>
2019-12-06 16:05   ` [PATCH 47/79] NetworkPkg/Mtftp6Dxe: Fix various typos Rabeda, Maciej
     [not found] ` <20191203161602.15969-46-philmd@redhat.com>
2019-12-06 16:05   ` [PATCH 45/79] NetworkPkg/MnpDxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-41-philmd@redhat.com>
2019-12-06 16:05   ` [PATCH 40/79] NetworkPkg/HttpDxe: " Rabeda, Maciej
     [not found] ` <20191203161602.15969-49-philmd@redhat.com>
2019-12-06 16:09   ` [PATCH 48/79] NetworkPkg/SnpDxe: Fix few typos Rabeda, Maciej
2019-12-06 16:38     ` Philippe Mathieu-Daudé
2019-12-10  7:21 ` [PATCH 00/79] Fix a bunch of typos (part 1) Cœur
     [not found] ` <20191203161602.15969-70-philmd@redhat.com>
2019-12-13  2:33   ` [PATCH 69/79] ShellPkg/DynamicCommand: Fix various typos Gao, Zhichao
     [not found] ` <20191203161602.15969-69-philmd@redhat.com>
2019-12-13  2:33   ` [PATCH 68/79] ShellPkg/Application: " Gao, Zhichao

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-list from there: mbox

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

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

  git send-email \
    --in-reply-to=4dab8f85-5ef3-dc72-44de-eeda7778119b@redhat.com \
    --to=devel@edk2.groups.io \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox