Skip to content

Commit 1c913e7

Browse files
authored
Merge pull request #4086 from tgross35/misc-sync
[0.2] Small sync fixes and backports
2 parents 7c64d5d + a00d7e6 commit 1c913e7

File tree

20 files changed

+445
-36
lines changed

20 files changed

+445
-36
lines changed

build.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn rustc_version_cmd(is_clippy_driver: bool) -> Output {
132132

133133
cmd.arg("--version");
134134

135-
let output = cmd.output().ok().expect("Failed to get rustc version");
135+
let output = cmd.output().expect("Failed to get rustc version");
136136

137137
if !output.status.success() {
138138
panic!(
@@ -187,20 +187,14 @@ fn rustc_minor_nightly() -> (u32, bool) {
187187
}
188188

189189
fn which_freebsd() -> Option<i32> {
190-
let output = std::process::Command::new("freebsd-version").output().ok();
191-
if output.is_none() {
192-
return None;
193-
}
194-
let output = output.unwrap();
190+
let output = std::process::Command::new("freebsd-version")
191+
.output()
192+
.ok()?;
195193
if !output.status.success() {
196194
return None;
197195
}
198196

199-
let stdout = String::from_utf8(output.stdout).ok();
200-
if stdout.is_none() {
201-
return None;
202-
}
203-
let stdout = stdout.unwrap();
197+
let stdout = String::from_utf8(output.stdout).ok()?;
204198

205199
match &stdout {
206200
s if s.starts_with("10") => Some(10),
@@ -217,24 +211,16 @@ fn emcc_version_code() -> Option<u64> {
217211
let output = std::process::Command::new("emcc")
218212
.arg("-dumpversion")
219213
.output()
220-
.ok();
221-
if output.is_none() {
222-
return None;
223-
}
224-
let output = output.unwrap();
214+
.ok()?;
225215
if !output.status.success() {
226216
return None;
227217
}
228218

229-
let stdout = String::from_utf8(output.stdout).ok();
230-
if stdout.is_none() {
231-
return None;
232-
}
233-
let version = stdout.unwrap();
219+
let version = String::from_utf8(output.stdout).ok()?;
234220

235221
// Some Emscripten versions come with `-git` attached, so split the
236222
// version string also on the `-` char.
237-
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
223+
let mut pieces = version.trim().split(['.', '-']);
238224

239225
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
240226
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);

ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ about above), and then shut down.
161161
poweroff
162162

163163
1. Exit the post install shell: `exit`
164-
1. Back in in the installer choose Reboot
164+
1. Back in the installer choose Reboot
165165
1. If all went well the machine should reboot and show a login prompt. If you
166166
switch to the serial console by choosing View > serial0 in the qemu menu,
167167
you should be logged in as root.

ci/style.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rustfmt -V
1111
cargo fmt --all -- --check
1212

1313
if shellcheck --version ; then
14-
find . -name '*.sh' -exec shellcheck {} ';'
14+
find . -name '*.sh' -print0 | xargs -0 shellcheck
1515
else
1616
echo "shellcheck not found"
1717
exit 1
@@ -29,4 +29,12 @@ for file in libc-test/semver/*.txt; do
2929
echo "Unsorted semver file $file"
3030
exit 1
3131
fi
32+
33+
duplicates=$(uniq -d "$file")
34+
if [ -n "$duplicates" ]; then
35+
echo "Semver file $file contains duplicates:"
36+
echo "$duplicates"
37+
38+
exit 1
39+
fi
3240
done

libc-test/build.rs

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ fn test_apple(target: &str) {
232232
"netinet/ip.h",
233233
"netinet/tcp.h",
234234
"netinet/udp.h",
235+
"netinet6/in6_var.h",
235236
"os/clock.h",
236237
"os/lock.h",
237238
"os/signpost.h",
@@ -401,6 +402,7 @@ fn test_apple(target: &str) {
401402
("__darwin_arm_neon_state64", "__v") => true,
402403

403404
("ifreq", "ifr_ifru") => true,
405+
("in6_ifreq", "ifr_ifru") => true,
404406
("ifkpi", "ifk_data") => true,
405407
("ifconf", "ifc_ifcu") => true,
406408
// FIXME: this field has been incorporated into a resized `rmx_filler` array.
@@ -1789,6 +1791,8 @@ fn test_android(target: &str) {
17891791
"linux/netfilter/nfnetlink_log.h",
17901792
"linux/netfilter/nfnetlink_queue.h",
17911793
"linux/netfilter/nf_tables.h",
1794+
"linux/netfilter_arp.h",
1795+
"linux/netfilter_bridge.h",
17921796
"linux/netfilter_ipv4.h",
17931797
"linux/netfilter_ipv6.h",
17941798
"linux/netfilter_ipv6/ip6_tables.h",
@@ -1858,6 +1862,7 @@ fn test_android(target: &str) {
18581862

18591863
// These are tested in the `linux_elf.rs` file.
18601864
"Elf64_Phdr" | "Elf32_Phdr" => true,
1865+
18611866
// These are intended to be opaque
18621867
"posix_spawn_file_actions_t" => true,
18631868
"posix_spawnattr_t" => true,
@@ -2463,7 +2468,7 @@ fn test_freebsd(target: &str) {
24632468
true
24642469
}
24652470

2466-
// Added in in FreeBSD 13.0 (r367776 and r367287)
2471+
// Added in FreeBSD 13.0 (r367776 and r367287)
24672472
"SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true,
24682473

24692474
// Added in FreeBSD 14
@@ -2593,6 +2598,13 @@ fn test_freebsd(target: &str) {
25932598
true
25942599
}
25952600

2601+
// Added in FreeBSD 14.1
2602+
"KCMP_FILE" | "KCMP_FILEOBJ" | "KCMP_FILES" | "KCMP_SIGHAND" | "KCMP_VM"
2603+
if Some(14) > freebsd_ver =>
2604+
{
2605+
true
2606+
}
2607+
25962608
// FIXME: Removed in FreeBSD 15:
25972609
"LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true,
25982610

@@ -2713,6 +2725,9 @@ fn test_freebsd(target: &str) {
27132725
true
27142726
}
27152727

2728+
// Those are introduced in FreeBSD 14.1.
2729+
"kcmp" => true,
2730+
27162731
_ => false,
27172732
}
27182733
});
@@ -3591,6 +3606,8 @@ fn test_linux(target: &str) {
35913606
"linux/netfilter/nfnetlink_log.h",
35923607
"linux/netfilter/nfnetlink_queue.h",
35933608
"linux/netfilter/nf_tables.h",
3609+
"linux/netfilter_arp.h",
3610+
"linux/netfilter_bridge.h",
35943611
"linux/netfilter_ipv4.h",
35953612
"linux/netfilter_ipv6.h",
35963613
"linux/netfilter_ipv6/ip6_tables.h",
@@ -3678,6 +3695,14 @@ fn test_linux(target: &str) {
36783695
});
36793696

36803697
cfg.skip_type(move |ty| {
3698+
// FIXME: very recent additions to musl, not yet released.
3699+
// also apparently some glibc versions
3700+
if ty == "Elf32_Relr" || ty == "Elf64_Relr" {
3701+
return true;
3702+
}
3703+
if sparc64 && (ty == "Elf32_Rela" || ty == "Elf64_Rela") {
3704+
return true;
3705+
}
36813706
match ty {
36823707
// FIXME: `sighandler_t` type is incorrect, see:
36833708
// https://github.com/rust-lang/libc/issues/1359
@@ -4112,9 +4137,15 @@ fn test_linux(target: &str) {
41124137
| "MINSIGSTKSZ"
41134138
if gnu => true,
41144139

4115-
// FIXME: Linux >= 5.16 changed its value:
4140+
// FIXME: Linux >= 5.10:
4141+
// https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493
4142+
"NF_INET_INGRESS" if musl => true,
4143+
4144+
// FIXME: Linux >= 5.16:
41164145
// https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96
4117-
"NF_NETDEV_NUMHOOKS" => true,
4146+
"NF_NETDEV_EGRESS" if musl || sparc64 => true,
4147+
// value changed
4148+
"NF_NETDEV_NUMHOOKS" if musl || sparc64 => true,
41184149

41194150
// FIXME: requires Linux >= 5.6:
41204151
| "RESOLVE_BENEATH"

libc-test/semver/TODO-linux.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The following symbols are not not available in some combinations of
1+
# The following symbols are not available in some combinations of
22
# musl/gnu/android and/or architecture.
33
KEYCTL_CAPABILITIES
44
KEYCTL_CAPS0_BIG_KEY

libc-test/semver/android.txt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
ABS_CNT
52
ABS_MAX
63
ADDR_COMPAT_LAYOUT
@@ -1692,8 +1689,29 @@ NFULNL_COPY_PACKET
16921689
NFULNL_MSG_CONFIG
16931690
NFULNL_MSG_PACKET
16941691
NF_ACCEPT
1692+
NF_ARP
1693+
NF_ARP_FORWARD
1694+
NF_ARP_IN
1695+
NF_ARP_NUMHOOKS
1696+
NF_ARP_OUT
1697+
NF_BR_BROUTING
1698+
NF_BR_FORWARD
1699+
NF_BR_LOCAL_IN
1700+
NF_BR_LOCAL_OUT
1701+
NF_BR_NUMHOOKS
1702+
NF_BR_POST_ROUTING
1703+
NF_BR_PRE_ROUTING
1704+
NF_BR_PRI_BRNF
1705+
NF_BR_PRI_FILTER_BRIDGED
1706+
NF_BR_PRI_FILTER_OTHER
1707+
NF_BR_PRI_FIRST
1708+
NF_BR_PRI_LAST
1709+
NF_BR_PRI_NAT_DST_BRIDGED
1710+
NF_BR_PRI_NAT_DST_OTHER
1711+
NF_BR_PRI_NAT_SRC
16951712
NF_DROP
16961713
NF_INET_FORWARD
1714+
NF_INET_INGRESS
16971715
NF_INET_LOCAL_IN
16981716
NF_INET_LOCAL_OUT
16991717
NF_INET_NUMHOOKS
@@ -1715,6 +1733,7 @@ NF_IP6_PRI_MANGLE
17151733
NF_IP6_PRI_NAT_DST
17161734
NF_IP6_PRI_NAT_SRC
17171735
NF_IP6_PRI_RAW
1736+
NF_IP6_PRI_RAW_BEFORE_DEFRAG
17181737
NF_IP6_PRI_SECURITY
17191738
NF_IP6_PRI_SELINUX_FIRST
17201739
NF_IP6_PRI_SELINUX_LAST
@@ -1735,10 +1754,12 @@ NF_IP_PRI_MANGLE
17351754
NF_IP_PRI_NAT_DST
17361755
NF_IP_PRI_NAT_SRC
17371756
NF_IP_PRI_RAW
1757+
NF_IP_PRI_RAW_BEFORE_DEFRAG
17381758
NF_IP_PRI_SECURITY
17391759
NF_IP_PRI_SELINUX_FIRST
17401760
NF_IP_PRI_SELINUX_LAST
17411761
NF_MAX_VERDICT
1762+
NF_NETDEV_EGRESS
17421763
NF_NETDEV_INGRESS
17431764
NF_NETDEV_NUMHOOKS
17441765
NF_QUEUE

libc-test/semver/apple.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,7 @@ globfree
20032003
host_cpu_load_info
20042004
host_cpu_load_info_data_t
20052005
host_cpu_load_info_t
2006+
icmp6_ifstat
20062007
iconv
20072008
iconv_close
20082009
iconv_open
@@ -2018,6 +2019,9 @@ ifconf
20182019
ifkpi
20192020
ifreq
20202021
image_offset
2022+
in6_addrlifetime
2023+
in6_ifreq
2024+
in6_ifstat
20212025
in6_pktinfo
20222026
in_pktinfo
20232027
initgroups
@@ -2338,6 +2342,7 @@ timeval32
23382342
timex
23392343
truncate
23402344
ttyname_r
2345+
u_quad_t
23412346
ucontext_t
23422347
unmount
23432348
useconds_t

libc-test/semver/freebsd.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,11 @@ JAIL_SYS_DISABLE
689689
JAIL_SYS_INHERIT
690690
JAIL_SYS_NEW
691691
JAIL_UPDATE
692+
KCMP_FILE
693+
KCMP_FILEOBJ
694+
KCMP_FILES
695+
KCMP_SIGHAND
696+
KCMP_VM
692697
KENV_DUMP
693698
KENV_DUMP_LOADER
694699
KENV_DUMP_STATIC
@@ -2007,6 +2012,7 @@ jail_get
20072012
jail_remove
20082013
jail_set
20092014
jrand48
2015+
kcmp
20102016
kevent
20112017
key_t
20122018
killpg

libc-test/semver/linux-aarch64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ BPF_W
3838
BPF_X
3939
BPF_XOR
4040
CIBAUD
41+
Elf32_Rela
42+
Elf64_Rela
4143
FICLONE
4244
FICLONERANGE
4345
MADV_SOFT_OFFLINE

libc-test/semver/linux-i686.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ EFL
1515
EIP
1616
ES
1717
ESI
18+
Elf32_Rela
19+
Elf64_Rela
1820
FS
1921
GS
2022
KEYCTL_CAPABILITIES

libc-test/semver/linux-musl.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ copy_file_range
7878
ctermid
7979
dirname
8080
eaccess
81+
endutxent
8182
euidaccess
8283
explicit_bzero
8384
futimes
8485
getauxval
8586
getloadavg
87+
getutxent
88+
getutxid
89+
getutxline
8690
lio_listio
8791
ntptimeval
8892
open_wmemstream
@@ -94,8 +98,10 @@ prlimit
9498
prlimit64
9599
process_vm_readv
96100
process_vm_writev
101+
pututxline
97102
pwritev2
98103
pwritev64
99104
reallocarray
105+
setutxent
100106
tcp_info
101107
timex

libc-test/semver/linux-powerpc64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ B2500000
22
B3000000
33
B3500000
44
B4000000
5+
Elf32_Rela
6+
Elf64_Rela
57
KEYCTL_CAPABILITIES
68
KEYCTL_CAPS0_BIG_KEY
79
KEYCTL_CAPS0_CAPABILITIES

libc-test/semver/linux-riscv64gc.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ COMPAT_HWCAP_ISA_F
1010
COMPAT_HWCAP_ISA_I
1111
COMPAT_HWCAP_ISA_M
1212
COMPAT_HWCAP_ISA_V
13+
Elf32_Rela
14+
Elf64_Rela
1315
KEYCTL_CAPABILITIES
1416
KEYCTL_CAPS0_BIG_KEY
1517
KEYCTL_CAPS0_CAPABILITIES

libc-test/semver/linux-x86_64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ CIBAUD
4141
CS
4242
DS
4343
ES
44+
Elf32_Rela
45+
Elf64_Rela
4446
FS
4547
GS
4648
MADV_SOFT_OFFLINE

0 commit comments

Comments
 (0)