← Back to team overview

kernel-packages team mailing list archive

[Bug 1483440] Re: odd behavior with /proc/net/route reading via sh 'read'

 

** Changed in: linux (Ubuntu Wily)
    Milestone: ubuntu-15.08 => ubuntu-15.09

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1483440

Title:
  odd behavior with /proc/net/route reading via sh 'read'

Status in linux package in Ubuntu:
  Fix Committed
Status in linux source package in Wily:
  Fix Committed

Bug description:
  I saw some strange behavior when one of my scripts started failing to
  get the data it was looking for out of /proc/net/route

  $ uname -r
  $ dpkg -S /boot/vmlinux-$(uname -r)
  linux-image-4.1.0-3-generic: /boot/vmlinuz-4.1.0-3-generic

  
  $ id -u
  1000
  $ cp /proc/net/route /tmp/route
  $ diff /proc/net/route /tmp/route
  $ md5sum /proc/net/route /tmp/route
  4b3663ec7554cf91764106ea9dcc2ada  /proc/net/route
  4b3663ec7554cf91764106ea9dcc2ada  /tmp/route

  ## just cat the file
  $ cat /proc/net/route
  Iface Destination Gateway  Flags RefCnt   Use   Metric   Mask     MTU   Window   IRTT
  eth0  00000000 01A8F50A 0003  0  0  0  00000000 00 0
  eth0  00A8F50A 00000000 0001  0  0  0  00F8FFFF 00 0
  virbr0   007AA8C0 00000000 0001  0  0  0  00FFFFFF 00 0

  ## try to read it with sh while loop
  $ sh -c 'while read line; do echo line: $line; done' < /proc/net/route
  line: Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
  line: eth0 00A8F50A 00000000 0001 0 0 0 00F8FFFF 0 0 0
  line: virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0

  ## odd, where did the first line go?
  ##
  ## maybe its still there if we cat
  $ cat /proc/net/route | sh -c 'while read line; do echo line: $line; done'
  line: Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
  line: eth0 00000000 01A8F50A 0003 0 0 0 00000000 0 0 0
  line: eth0 00A8F50A 00000000 0001 0 0 0 00F8FFFF 0 0 0
  line: virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0

  ## Yep, still there.
  ## as expected, the copied file shows sane behavior
  $ sh -c 'while read line; do echo line: $line; done' < /tmp/route
  line: Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
  line: eth0 00000000 01A8F50A 0003 0 0 0 00000000 0 0 0
  line: eth0 00A8F50A 00000000 0001 0 0 0 00F8FFFF 0 0 0
  line: virbr0 007AA8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0

  ProblemType: Bug
  DistroRelease: Ubuntu 15.10
  Package: linux-image-4.1.0-3-generic 4.1.0-3.3
  ProcVersionSignature: User Name 4.1.0-3.3-generic 4.1.3
  Uname: Linux 4.1.0-3-generic x86_64
  AlsaDevices:
   total 0
   crw-rw---- 1 root audio 116,  1 Aug 10 23:52 seq
   crw-rw---- 1 root audio 116, 33 Aug 10 23:52 timer
  AplayDevices: Error: [Errno 2] No such file or directory: 'aplay'
  ApportVersion: 2.18-0ubuntu6
  Architecture: amd64
  ArecordDevices: Error: [Errno 2] No such file or directory: 'arecord'
  AudioDevicesInUse: Error: command ['fuser', '-v', '/dev/snd/seq', '/dev/snd/timer'] failed with exit code 1:
  Date: Mon Aug 10 23:55:09 2015
  IwConfig: Error: [Errno 2] No such file or directory: 'iwconfig'
  MachineType: HP ProLiant DL360 Gen9
  PciMultimedia:

  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcFB: 0 EFI VGA
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.1.0-3-generic root=UUID=ebea97f1-7014-4fac-bc87-c8ff465c566f ro --- console=ttyS1,115200
  RelatedPackageVersions:
   linux-restricted-modules-4.1.0-3-generic N/A
   linux-backports-modules-4.1.0-3-generic  N/A
   linux-firmware                           1.146
  RfKill: Error: [Errno 2] No such file or directory: 'rfkill'
  SourcePackage: linux
  UdevLog: Error: [Errno 2] No such file or directory: '/var/log/udev'
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 03/05/2015
  dmi.bios.vendor: HP
  dmi.bios.version: P89
  dmi.chassis.type: 23
  dmi.chassis.vendor: HP
  dmi.modalias: dmi:bvnHP:bvrP89:bd03/05/2015:svnHP:pnProLiantDL360Gen9:pvr:cvnHP:ct23:cvr:
  dmi.product.name: ProLiant DL360 Gen9
  dmi.sys.vendor: HP

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1483440/+subscriptions


References