mirror of
https://github.com/sigoden/dufs.git
synced 2026-04-08 16:49:02 +03:00
[GH-ISSUE #563] check_addrs for error #335
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ByteXiaoTang on GitHub (Mar 31, 2025).
Original GitHub issue: https://github.com/sigoden/dufs/issues/563
fn check_addrs(args: &Args) -> Result<(Vec, Vec)> {
let mut new_addrs = vec![];
let mut print_addrs = vec![];
let (ipv4_addrs, ipv6_addrs) = interface_addrs()?;
for bind_addr in args.addrs.iter() {
match bind_addr {
BindAddr::IpAddr(ip) => match &ip {
IpAddr::V4() => {
if !ipv4_addrs.is_empty() {
new_addrs.push(bind_addr.clone());
if ip.is_unspecified() {
print_addrs.extend(ipv4_addrs.clone());
} else {
print_addrs.push(bind_addr.clone());
}
}
}
IpAddr::V6() => {
if !ipv6_addrs.is_empty() {
new_addrs.push(bind_addr.clone());
if ip.is_unspecified() {
print_addrs.extend(ipv6_addrs.clone());
} else {
print_addrs.push(bind_addr.clone())
}
}
}
},
#[cfg(unix)]
_ => {
new_addrs.push(bind_addr.clone());
print_addrs.push(bind_addr.clone())
}
}
}
print_addrs.sort_unstable();
Ok((new_addrs, print_addrs))
} this code will print_addrs.extend(ipv4_addrs.clone()); not remove the same addr, when args.addrs.iter() has many
@sigoden commented on GitHub (Mar 31, 2025):
@ByteXiaoTang
Just tell me how to reproduce the bug you mentioned.