Bug#840975: ifupdown: When running /etc/network/interfaces.d/, editor backups aren't ignored

2022-08-12 Thread Jérémie Courrèges-Anglas
On Wed, 19 Oct 2016 20:38:54 +0200 Guus Sliepen 
wrote:
> On Sun, Oct 16, 2016 at 09:14:31AM -0500, Dan Greene wrote:
> 
> > I edited /etc/networking/interfaces.d/wlan0 on my system using jo
> > to change the configuration. When saving, many editors, including
> > joe, leave backups that end with a tilde '~'. When I run
> > $ ifup wlan0
> > or when the system tries to bring up the interface at boot, the
> > system loads the backup created by the editor in addition to the
> > current version, and as a result, gets confused. (I believe it
tries
> > to set the route twice.)
> > 
> > This, of course, results in the network not working, and the reason
is
> > not obvious, leading to wasted time trying to fix it.
> 
> I suspect something else is happening here, because ifup only reads
> those files that consists only of a-z, A-Z, 0-9, _ and -. So files
with
> a tilde, whereever they appear in the filename, are ignored.

That's partly true, it depends on whether the configuration uses
"source /some/dir/*" or "source-dir /some/dir/". The former doesn't use
scandir(3) or the directory_filter() function, only the latter does
filter file names like you describe.  Sadly the postinst script puts

  source /etc/network/interfaces.d/*

in /etc/network/interfaces by default.

> In order to find out what the real problem is, could you send me a
copy
> of your /etc/network/interfaces, /etc/network/interfaces.d/wlan0?
Also,
> do ifdown wlan0, and then run this command:
> 
> ifup -v wlan0 2>&1 >ifup.log
> 
> And send me a copy of ifup.log. You can of course also look at it
> yourself, it should tell you exactly what ifup is trying to do and
what
> commands it is executing.

See the attached config.txt and ifup-v... files.

-- 
Jeremie Courreges-Anglas
Administrateur Systeme et Reseau
celeste.fr - oceanet-technology.com


ifup: parsing file /etc/network/interfaces.d/tralala~
if test -d /sys/class/net/eno2 && ! ip link show eno2.1400 >/dev/null 
2>&1; then if test `cat /sys/class/net/eno2/type` -eq 32; then  
   echo 0x1400 > /sys/class/net/eno2/create_child; else 
ip link set up dev eno2; ip link add link eno2 name eno2.1400 type 
vlan id 1400;fi; fi

ifup: configuring interface eno2.1400=eno2.1400 (inet)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/bridge
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/hostapd
run-parts: executing /etc/network/if-pre-up.d/ifenslave
+ [ inet = meta ]
+ IF_BOND_SLAVES=
+ [ -n  ]
+ [ -n  ]
+ [ -n  ]
+ exit 0
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
ip addr add 192.0.2.64/255.255.255.0 broadcast 192.0.2.255dev eno2.1400 
label eno2.1400
ip link set dev eno2.1400   up

run-parts --exit-on-error --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/avahi-autoipd
run-parts: executing /etc/network/if-up.d/clamav-freshclam-ifupdown
run-parts: executing /etc/network/if-up.d/ethtool
run-parts: executing /etc/network/if-up.d/ifenslave
+ [ inet = meta ]
+ [  ]
run-parts: executing /etc/network/if-up.d/ntpsec-ntpdate
run-parts: executing /etc/network/if-up.d/openvpn
run-parts: executing /etc/network/if-up.d/wpasupplicant
ca@OT-PORT-023:~/src/ifupdown-0.8.37$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*
#source-dir /etc/network/interfaces.d/

# The loopback network interface
auto lo
iface lo inet loopback
jca@OT-PORT-023:~/src/ifupdown-0.8.37$ ls /etc/network/interfaces.d/
tralala~
jca@OT-PORT-023:~/src/ifupdown-0.8.37$ cat /etc/network/interfaces.d/tralala~ 
auto eno2.1400
iface eno2.1400 inet static
address 192.0.2.64/24


Bug#840975: ifupdown: When running /etc/network/interfaces.d/, editor backups aren't ignored

2016-10-19 Thread Guus Sliepen
On Sun, Oct 16, 2016 at 09:14:31AM -0500, Dan Greene wrote:

> I edited /etc/networking/interfaces.d/wlan0 on my system using jo
> to change the configuration. When saving, many editors, including
> joe, leave backups that end with a tilde '~'. When I run
> $ ifup wlan0
> or when the system tries to bring up the interface at boot, the
> system loads the backup created by the editor in addition to the
> current version, and as a result, gets confused. (I believe it tries
> to set the route twice.)
> 
> This, of course, results in the network not working, and the reason is
> not obvious, leading to wasted time trying to fix it.

I suspect something else is happening here, because ifup only reads
those files that consists only of a-z, A-Z, 0-9, _ and -. So files with
a tilde, whereever they appear in the filename, are ignored.

In order to find out what the real problem is, could you send me a copy
of your /etc/network/interfaces, /etc/network/interfaces.d/wlan0? Also,
do ifdown wlan0, and then run this command:

ifup -v wlan0 2>&1 >ifup.log

And send me a copy of ifup.log. You can of course also look at it
yourself, it should tell you exactly what ifup is trying to do and what
commands it is executing.

-- 
Met vriendelijke groet / with kind regards,
  Guus Sliepen 


signature.asc
Description: Digital signature


Bug#840975: ifupdown: When running /etc/network/interfaces.d/, editor backups aren't ignored

2016-10-16 Thread Dan Greene
Package: ifupdown
Version: 0.8.16
Severity: normal

Dear Maintainer,

I edited /etc/networking/interfaces.d/wlan0 on my system using jo
to change the configuration. When saving, many editors, including
joe, leave backups that end with a tilde '~'. When I run
$ ifup wlan0
or when the system tries to bring up the interface at boot, the
system loads the backup created by the editor in addition to the
current version, and as a result, gets confused. (I believe it tries
to set the route twice.)

This, of course, results in the network not working, and the reason is
not obvious, leading to wasted time trying to fix it.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.7.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ifupdown depends on:
ii  adduser  3.115
ii  init-system-helpers  1.45
ii  iproute2 4.6.0-4
ii  libc62.24-3
ii  lsb-base 9.20160629

Versions of packages ifupdown recommends:
ii  isc-dhcp-client [dhcp-client]  4.3.5~b1-1

Versions of packages ifupdown suggests:
pn  ppp 
pn  rdnssd  

-- no debconf information