[PR #4918] [MERGED] testing: fix expect matching of numbers #5299

Closed
opened 2026-05-05 10:35:53 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netblue30/firejail/pull/4918
Author: @smitsohu
Created: 2/9/2022
Status: Merged
Merged: 2/9/2022
Merged by: @netblue30

Base: masterHead: tests2


📝 Commits (1)

  • 7578e86 testing: fix expect matching of numbers

📊 Changes

244 files changed (+559 additions, -523 deletions)

View changed files

📝 test/appimage/appimage-args.exp (+2 -2)
📝 test/appimage/appimage-trace.exp (+2 -2)
📝 test/appimage/appimage-v1.exp (+2 -2)
📝 test/appimage/appimage-v2.exp (+2 -2)
📝 test/apps-x11-xorg/firefox.exp (+1 -1)
📝 test/apps-x11-xorg/thunderbird.exp (+1 -1)
📝 test/apps-x11-xorg/transmission-gtk.exp (+1 -1)
📝 test/apps-x11-xorg/transmission-qt.exp (+1 -1)
📝 test/apps-x11/chromium.exp (+1 -1)
📝 test/apps-x11/firefox.exp (+1 -1)
📝 test/apps-x11/thunderbird.exp (+1 -1)
📝 test/apps-x11/transmission-gtk.exp (+1 -1)
📝 test/apps-x11/x11-none.exp (+1 -1)
📝 test/apps-x11/x11-xephyr.exp (+2 -2)
📝 test/apps-x11/xterm-xephyr.exp (+1 -1)
📝 test/apps-x11/xterm-xorg.exp (+1 -1)
📝 test/apps-x11/xterm-xpra.exp (+1 -1)
📝 test/apps/chromium.exp (+2 -2)
📝 test/apps/deluge.exp (+2 -2)
📝 test/apps/fbreader.exp (+2 -2)

...and 80 more files

📄 Description

The sandbox timestamp should not be available for matching when output is already expected from the following command.

This is an issue if numeric output if expected from the first command in the sandbox and can lead to tests that fail and succeed in a non-deterministic fashion. As far as I can tell only a small number of tests is affected by this problem, but it was easiest to to just "fix" it everywhere.

To reproduce add -d to the expect command line and for instance run test/environment/keep-fd.exp. Some relevant lines:

send: sending "ls /proc/self/fd | wc -w\r" to { exp5 }

expect: does " in 68.64 ms\r\n" (spawn_id exp5) match glob pattern "4"? yes
expect: set expect_out(0,string) "4"
expect: set expect_out(spawn_id) "exp5"
expect: set expect_out(buffer) " in 68.64"

People more familiar with expect might find better ways to achieve the same result. One possible alternative I'm aware of would be to flush the expect output buffer with expect "*" after the sandbox is up.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netblue30/firejail/pull/4918 **Author:** [@smitsohu](https://github.com/smitsohu) **Created:** 2/9/2022 **Status:** ✅ Merged **Merged:** 2/9/2022 **Merged by:** [@netblue30](https://github.com/netblue30) **Base:** `master` ← **Head:** `tests2` --- ### 📝 Commits (1) - [`7578e86`](https://github.com/netblue30/firejail/commit/7578e86ef8ddb78da44d426b94def77366627e0e) testing: fix expect matching of numbers ### 📊 Changes **244 files changed** (+559 additions, -523 deletions) <details> <summary>View changed files</summary> 📝 `test/appimage/appimage-args.exp` (+2 -2) 📝 `test/appimage/appimage-trace.exp` (+2 -2) 📝 `test/appimage/appimage-v1.exp` (+2 -2) 📝 `test/appimage/appimage-v2.exp` (+2 -2) 📝 `test/apps-x11-xorg/firefox.exp` (+1 -1) 📝 `test/apps-x11-xorg/thunderbird.exp` (+1 -1) 📝 `test/apps-x11-xorg/transmission-gtk.exp` (+1 -1) 📝 `test/apps-x11-xorg/transmission-qt.exp` (+1 -1) 📝 `test/apps-x11/chromium.exp` (+1 -1) 📝 `test/apps-x11/firefox.exp` (+1 -1) 📝 `test/apps-x11/thunderbird.exp` (+1 -1) 📝 `test/apps-x11/transmission-gtk.exp` (+1 -1) 📝 `test/apps-x11/x11-none.exp` (+1 -1) 📝 `test/apps-x11/x11-xephyr.exp` (+2 -2) 📝 `test/apps-x11/xterm-xephyr.exp` (+1 -1) 📝 `test/apps-x11/xterm-xorg.exp` (+1 -1) 📝 `test/apps-x11/xterm-xpra.exp` (+1 -1) 📝 `test/apps/chromium.exp` (+2 -2) 📝 `test/apps/deluge.exp` (+2 -2) 📝 `test/apps/fbreader.exp` (+2 -2) _...and 80 more files_ </details> ### 📄 Description The sandbox timestamp should not be available for matching when output is already `expect`ed from the following command. This is an issue if numeric output if `expect`ed from the first command in the sandbox and can lead to tests that fail and succeed in a non-deterministic fashion. As far as I can tell only a small number of tests is affected by this problem, but it was easiest to to just "fix" it everywhere. To reproduce add `-d` to the `expect` command line and for instance run test/environment/keep-fd.exp. Some relevant lines: ``` send: sending "ls /proc/self/fd | wc -w\r" to { exp5 } expect: does " in 68.64 ms\r\n" (spawn_id exp5) match glob pattern "4"? yes expect: set expect_out(0,string) "4" expect: set expect_out(spawn_id) "exp5" expect: set expect_out(buffer) " in 68.64" ``` People more familiar with `expect` might find better ways to achieve the same result. One possible alternative I'm aware of would be to flush the `expect` output buffer with `expect "*"` after the sandbox is up. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 10:35:53 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#5299
No description provided.