Skip to content

wall initial implementation - #578

Open
cmoibssld wants to merge 15 commits into
uutils:mainfrom
cmoibssld:main
Open

wall initial implementation#578
cmoibssld wants to merge 15 commits into
uutils:mainfrom
cmoibssld:main

Conversation

@cmoibssld

Copy link
Copy Markdown

This pull request introduces an implementation of the 'wall' utility. It aims to be a first-draft binary crate since the flags of the wall command are not implemented yet.

New utility implementation:

  • adds a new binary crate uu_wall on src/uu/wall with Cargo.toml specifying dependencies (uucore, clap, nix...)
  • implements the core logic inside wall.rs. supports message input from stdin or command-line arguments
  • a simple entrypoint in main.rs to call the utility with the uucore macro

CLI and mechanics:

  • uses clap for parsing arguments. CLI flags are parsed but not yet implemented (placeholder for future extension)
  • after retreiving the messages, scan all logged-in users via the utmpx utility and then proceed to write into their terminal the message.

@sylvestre

Copy link
Copy Markdown
Contributor

nice
could you please add unit tests in tests/ ?
thanks

@cakebaker cakebaker changed the title wall initial implentation wall initial implementation Jun 24, 2026
@sylvestre

Copy link
Copy Markdown
Contributor

a few jobs are failing
(i was going to review it)

@cmoibssld

Copy link
Copy Markdown
Author

Yes sorry I updated the pr by error, I still need to work on this

Copilot AI lite review requested due to automatic review settings August 13, 2026 06:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Introduces an initial implementation of the wall utility as a new optional workspace crate, along with basic CLI parsing and a small set of utility-specific tests.

Changes:

  • Adds new uu_wall crate (library + binary) and wires it into workspace features/dependencies
  • Implements Unix-only wall logic: message sourcing (stdin/args/file), scanning logged-in users via utmpx, and writing to ttys
  • Adds initial tests and minor formatting/import cleanups in existing test files

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/tests.rs Registers the wall test module behind the wall feature flag
tests/by-util/test_wall.rs Adds initial cross-platform tests for wall behavior
tests/by-util/test_setsid.rs Adjusts import ordering (no functional change)
tests/by-util/test_lslocks.rs Reflows an array literal for formatting (no functional change)
src/uu/wall/wall.md Adds minimal help/about text for wall
src/uu/wall/src/wall.rs Implements the core wall command logic and CLI definition
src/uu/wall/src/main.rs Adds binary entrypoint using uucore::bin!
src/uu/wall/Cargo.toml Adds new crate manifest and dependencies for uu_wall
Cargo.toml Enables wall as an optional workspace feature/dependency

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/uu/wall/src/wall.rs
Comment on lines +55 to +57
let matches = uucore::clap_localization::handle_clap_result(uu_app(), args)
.map_err(|e| USimpleError::new(1, e.to_string()))?; // Clap would have return 101
// Might be considered wrong for --help and --version
Comment thread src/uu/wall/src/wall.rs

let user = env::var_os(user).unwrap_or_default();
// Fetch the TTY of the process calling wall (requires OS-specific calls or a wrapper function)
let tty = &get_sender();
Comment thread src/uu/wall/src/wall.rs
Comment on lines +38 to +39
#[error("wall: cannot read stdin")]
Stdin(#[from] io::Error),
Comment thread src/uu/wall/src/wall.rs
Comment on lines +173 to +175
fn read_from_file(file: &OsString) -> Result<String, WallError> {
let mut buffer = Vec::new();
let mut file = std::fs::File::open(file)?;
Comment thread src/uu/wall/src/wall.rs
let datetime = get_hour_and_date();
#[cfg(target_os = "macos")]
return format!(
"\r\nBroadcast message from {}@{} ({tty}) at ({datetime} \r\n\r\n",
Comment thread src/uu/wall/src/wall.rs
.long(OPT_NOBANNER)
.required(false)
.action(ArgAction::SetTrue)
.help("Suppress the intro branner of the broadcast"),
Comment thread src/uu/wall/Cargo.toml
[dependencies]
chrono = { workspace = true }
clap.workspace = true
nix = { workspace = true, features = ["feature", "fs", "hostname", "term"] }
#[cfg(target_os = "linux")]
#[test]
fn test_invalid_file() {
new_ucmd!().arg("not_existing_file.not_existing_extension"); // Should print non-file name as broadcast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants