Skip to content

Commit

Permalink
refactor: update nix
Browse files Browse the repository at this point in the history
  • Loading branch information
anonkey committed Feb 15, 2024
1 parent f34d00d commit 1faf396
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,32 @@ jobs:
- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index

macos-aarch64:
runs-on: macos-14
env:
TARGET: aarch64-apple-darwin
steps:
- name: checkout
uses: actions/checkout@v4

- name: setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: '${{ env.MSRV }}'
components: clippy

- name: build
uses: ./.github/actions/build
with:
TARGET: "${{ env.TARGET }}"

- name: test
uses: ./.github/actions/test
with:
TARGET: "${{ env.TARGET }}"

- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index

# Use cross for QEMU-based testing
# cross needs to execute Docker, GitHub Action already has it installed
Expand Down
1 change: 1 addition & 0 deletions changelog/2311.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed `::unistd::Group::members` using read_unaligned to avoid crash on misaligned pointers
23 changes: 23 additions & 0 deletions test/test_unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,3 +1372,26 @@ fn test_eaccess_file_exists() {
eaccess(&path, AccessFlags::R_OK | AccessFlags::W_OK)
.expect("assertion failed");
}

#[test]
#[cfg(bsd)]
fn test_group_from() {
let group = Group::from_name("wheel").unwrap().unwrap();
let group = Group::from_name("daemon").unwrap().unwrap();
let group = Group::from_name("kmem").unwrap().unwrap();
let group = Group::from_name("sys").unwrap().unwrap();
let group = Group::from_name("tty").unwrap().unwrap();
let group = Group::from_name("operator").unwrap().unwrap();
let group = Group::from_name("procview").unwrap().unwrap();
let group = Group::from_name("procmod").unwrap().unwrap();
let group = Group::from_name("everyone").unwrap().unwrap();
let group = Group::from_name("staff").unwrap().unwrap();
let group = Group::from_name("certusers").unwrap().unwrap();
let group = Group::from_name("localaccounts").unwrap().unwrap();
let group = Group::from_name("admin").unwrap().unwrap();
assert!(group.name == "everyone");
let group_id = group.gid;
let group = Group::from_gid(group_id).unwrap().unwrap();
assert_eq!(group.gid, group_id);
assert_eq!(group.name, "everyone");
}

0 comments on commit 1faf396

Please sign in to comment.