Public bug reported:

When invoking the `logger` command on Ubuntu Jammy (bsdutils 2.37.2)
with explicit PID and passing messages via STDIN

```
echo "some message" | logger -p local0.info --id="$$"
```

the command produces the following error instead of sending the message
to syslog:

> logger: send message failed: Invalid argument

The error does not appear when the message is passed as an argument:

```
logger -p local0.info --id="$$" "some message"  # this works!
```

When using process substitution the error only appears for the first log
message:

```
exec > >(logger -p local0.info --id="$$")
echo "first message"   # throws error, message not logged
echo "second message"  # no error, message logged correctly
```

The issue does not exist in older versions (e.g. Ubuntu Xenial, bsdutils
2.27.1).

Workaround: Omit `--id` and include the PID in a tag.

```
echo "some message" | logger -p local0.info -t "foo[$$]"
```

Expected Behavior
-----------------

All messages passed via STDIN should be sent to syslog without throwing
an error.

OS Release
----------

Description:    Ubuntu 22.04 LTS
Release:        22.04

Package Version
---------------

bsdutils:
  Installed: 2.37.2-4ubuntu3
  Candidate: 2.37.2-4ubuntu3

** Affects: util-linux (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: jammy

** Description changed:

  When invoking the `logger` command on Ubuntu Jammy (bsdutils 2.37.2)
  with explicit PID and passing messages via STDIN
  
  ```
  echo "some message" | logger -p local0.info --id="$$"
  ```
  
- the command produces the following error:
+ the command produces the following error instead of sending the message
+ to syslog:
  
  > logger: send message failed: Invalid argument
  
  The error does not appear when the message is passed as an argument:
  
  ```
  logger -p local0.info --id="$$" "some message"  # this works!
  ```
  
  When using process substitution the error only appears for the first log
  message:
  
  ```
  exec > >(logger -p local0.info --id="$$")
  echo "first message"   # throws error, message not logged
  echo "second message"  # no error, message logged correctly
- ``` 
+ ```
  
  The issue does not exist in older versions (e.g. Ubuntu Xenial, bsdutils
  2.27.1).
  
  Workaround: Omit `--id` and include the PID in a tag.
  
  ```
  echo "some message" | logger -p local0.info -t "foo[$$]"
  ```
  
  Expected Behavior
  -----------------
  
  All messages passed via STDIN should be sent to syslog without throwing
  an error.
  
  OS Release
  ----------
  
  Description:  Ubuntu 22.04 LTS
  Release:      22.04
  
  Package Version
  ---------------
  
  bsdutils:
-   Installed: 2.37.2-4ubuntu3
-   Candidate: 2.37.2-4ubuntu3
+   Installed: 2.37.2-4ubuntu3
+   Candidate: 2.37.2-4ubuntu3

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1991436

Title:
  "invalid argument" error from logger command when passing messages via
  STDIN

Status in util-linux package in Ubuntu:
  New

Bug description:
  When invoking the `logger` command on Ubuntu Jammy (bsdutils 2.37.2)
  with explicit PID and passing messages via STDIN

  ```
  echo "some message" | logger -p local0.info --id="$$"
  ```

  the command produces the following error instead of sending the
  message to syslog:

  > logger: send message failed: Invalid argument

  The error does not appear when the message is passed as an argument:

  ```
  logger -p local0.info --id="$$" "some message"  # this works!
  ```

  When using process substitution the error only appears for the first
  log message:

  ```
  exec > >(logger -p local0.info --id="$$")
  echo "first message"   # throws error, message not logged
  echo "second message"  # no error, message logged correctly
  ```

  The issue does not exist in older versions (e.g. Ubuntu Xenial,
  bsdutils 2.27.1).

  Workaround: Omit `--id` and include the PID in a tag.

  ```
  echo "some message" | logger -p local0.info -t "foo[$$]"
  ```

  Expected Behavior
  -----------------

  All messages passed via STDIN should be sent to syslog without
  throwing an error.

  OS Release
  ----------

  Description:  Ubuntu 22.04 LTS
  Release:      22.04

  Package Version
  ---------------

  bsdutils:
    Installed: 2.37.2-4ubuntu3
    Candidate: 2.37.2-4ubuntu3

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1991436/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to