nixpkgs/pkgs/os-specific/linux
aszlig 639edcb829
manual-kernel: Fix handling spaces in readConfig.
The previos version did a for loop over the output of set, which spits out _all_
defined variables and their contents. This not only is dangerous if there is a
variable starting with CONFIG_ but also can't handle whitespace, as the IFS is
set to any (horizontal _and_ vertical) whitespace by default.

So, imagine (actually don't imagine, something like this is the case in a lot of
kernel configuration files) you have the following variable:

CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi ..."

A loop with for and the default IFS would result in the following variable
pieces:

0: CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi
1: -fcall-saved-rsi
2: ..."

This obviously leads to the problem that this config variable is being cut off
at the first whitespace.

Another downside of this approach is that set not only returns variables but
functions as well. This could lead to quite a lot of unexpected behaviour and
confusion.

So the new approach doesn't source the kernel configuration anymore but uses
`read` to parse the file line-by line, setting IFS to '=', thus splitting all
configuration lines into key/value pairs.

Using parameter expansion, we ensure that we only read lines starting with
"CONFIG_". This particularily has the advantage of not being bash-specific,
should we choose to change to a different default shell someday.

Now, after we got a correct "CONFIG_" line, we're using a temporary variable to
split off the first quote from the result. Particularily the reason behind this
is shell compatibility again, as ${${foo#"}%"} only works in Bash, Zsh and
whatnot but not in plain SH.

And within the next line we obviously insert the no_firstquote variable without
it's last quote removed.

But, what about escaping?

First of all, if we'd just eval the $val variable, we would correctly unescape
the value, but this has the downside that variables within the content would be
expanded, for example look at this:

CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

Well, obviously this is a bad example at the Nix sense, but just to show that
variables within kernel configuration entries aren't impossible.

And second, which would have been a show stopper if \" would be within $val: It
simply would end up being an invalid Nix expression, because \" would end up as
a ploin " within a double quoted string.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2012-12-13 22:54:57 +01:00
..
915resolution
acpi
acpi-call acpi-call: force example script to be executable 2012-08-03 16:49:57 +04:00
acpid acpid: Update to version 2.0.17. 2012-11-02 23:56:13 +01:00
acpitool
afuse
alsa-lib alsalib: update + more urls. 2012-10-20 10:53:21 +02:00
alsa-plugins alsa-plugins: Update to upstream version 1.0.26. 2012-12-03 11:10:17 +01:00
alsa-utils alsa-utils: Fix the path to alsactl in the udev rule 2012-10-02 11:09:28 -04:00
apparmor
atheros Remove a bunch of unreferenced files 2012-11-29 13:43:37 +01:00
ati-drivers making ati dirvers compile again 2012-10-07 18:03:06 +02:00
atop Atop: add package (atop is one more load monitor) 2012-08-25 21:24:17 +04:00
aufs Remove a bunch of unreferenced files 2012-11-29 13:43:37 +01:00
aufs-util Remove a bunch of unreferenced files 2012-11-29 13:43:37 +01:00
autofs
bbswitch
blcr
bluez Update Bluez/Obex 2012-10-29 23:56:26 +04:00
bridge-utils
broadcom-sta Fix broadcom_sta for linux-3.4 and clean nix source. 2012-07-19 11:42:40 +02:00
busybox busybox: Update to 1.20.2 2012-08-13 15:56:09 -04:00
checkpolicy
cifs-utils cifs-utils: upgrade to 5.6 2012-08-30 18:25:49 +02:00
conky conky: Enable weather plugins. 2012-09-10 23:54:00 +02:00
consoletools linuxconsoletools: New package, version 1.4.3. 2012-10-02 03:46:41 +02:00
cpufrequtils
cramfsswap
cryopid
cryptodev Mark some packages as low priority and disambiguate some others 2012-11-29 15:26:13 +01:00
cryptsetup cryptsetup: Update to 1.5.0 2012-08-10 18:54:10 -04:00
dietlibc
directvnc
dmidecode
dmraid Fix dmraid build 2012-07-18 09:25:58 -04:00
dmtcp
drbd
dstat add package dstat 2012-08-05 15:10:26 +02:00
e3cfsprogs
e1000e
ebtables
eject
exmap
fbterm Upstream tracking files for asymptote and fbterm 2012-12-04 14:55:19 +04:00
ffado Disable the debug option for FFADO 2012-10-07 22:33:50 +02:00
firmware iwlwifi-6000g2a-ucode: update to version 18.168.6.1 2012-11-18 13:20:46 +01:00
frandom
fuse
fxload
gogoclient gogoclient: fix url and lower default metric 2012-09-02 11:57:49 +02:00
hdparm
hibernate
hostapd hostapd: upgrade to 1.0 2012-09-09 13:04:14 +02:00
htop
hwdata
i7z
i810switch
ifplugd
iotop
iproute iproute: Update to 3.6.0 2012-10-11 15:38:54 -04:00
ipsec-tools ipsec-tools: add version 0.8.0 2012-10-20 13:06:09 +02:00
iptables iptables: upgrade to 1.4.16.2 2012-10-13 12:22:47 +02:00
iputils
iscsitarget
iw Adding linux iw. 2012-08-11 20:22:45 +02:00
iwlwifi
jujuutils
kbd kbd: Update to 1.15.3 2012-07-24 22:33:39 -04:00
kernel manual-kernel: Fix handling spaces in readConfig. 2012-12-13 22:54:57 +01:00
kernel-headers
kernel-headers-cross
kexectools
keyutils
klibc
kmod kmod: Bump to version 9 2012-07-29 03:57:50 -04:00
kqemu
latencytop
libaio
libatasmart
libcap libcap: Update to 2.22 2012-07-19 10:26:44 -04:00
libcgroup libcgroup: Update to 0.38 2012-07-30 13:48:19 -04:00
libnl Remove a bunch of unreferenced files 2012-11-29 13:43:37 +01:00
libnscd
libselinux
libsemanage
libsepol
libsmbios
libvolume_id
lm-sensors
lsiutil
lsscsi
lvm2 Work around some crazy race condition in devicemapper device creation 2012-10-15 14:46:15 -04:00
lxc Move lxc from "applications/virtualization" to "os-specific/linux". 2012-10-20 12:36:44 +02:00
mcelog
mdadm
microcode provides a better download url for the intel-microcode2ucode sources. 2012-08-17 19:25:05 +02:00
mingetty
module-init-tools
modutils
mountall Merge remote-tracking branch 'upstream/master' into x-updates 2012-07-14 14:24:27 -04:00
multipath-tools
ndiswrapper
net-tools
nfs-utils Remove duplicate tcp-wrappers package 2012-11-29 15:26:13 +01:00
nss_ldap
numactl
nvidia-x11 Add legacy version 304.64 of the Nvidia driver 2012-12-11 11:33:40 +01:00
open-iscsi
opengl/xorg-sys
ov511 Mark some packages as low priority and disambiguate some others 2012-11-29 15:26:13 +01:00
pam
pam_ccreds
pam_console
pam_devperm
pam_krb5
pam_ldap
pam_login
pam_ssh_agent_auth
pam_unix2
pam_usb
pcmciautils
pm-utils
pmount
pmtools pmtools: add version 20071116 2012-09-13 20:00:17 +02:00
policycoreutils
pommed
powertop powertop: upgrade to 2.1 2012-09-09 13:04:13 +02:00
procps
psmisc psmisc: update to version 22.19 2012-07-02 16:53:52 +02:00
pwdutils
qemu-kvm qemu-kvm: Update to 1.2.0 2012-09-25 17:30:43 -04:00
radeontools
regionset
reptyr Update/fix MuPDF 2012-10-04 10:37:54 +04:00
rfkill
rtkit
sdparm
shadow Apply patch to shadow which allows dots (.) in user names. 2012-09-18 23:56:51 +02:00
spl Mark some packages as low priority and disambiguate some others 2012-11-29 15:26:13 +01:00
splashutils
statifier
sysfsutils sysfsutils: Use SourceForge mirror instead of static URL. 2012-10-02 08:50:42 +02:00
sysklogd sysklogd: Support systemd socket-based activation 2012-07-19 12:46:39 -04:00
syslinux
sysstat Use /var/log/sa for statedir of sysstat, in stead of $out/var/lib/sa. This path cannot be overriden at runtime, so choosing a 'sane' default. 2012-08-14 14:14:55 +02:00
systemd systemd: Update to 196 2012-11-29 18:50:07 +01:00
sysvinit sysvinit: Don't install mountpoint and wall 2012-07-25 23:18:40 -04:00
tcp-wrappers Remove duplicate tcp-wrappers package 2012-11-29 15:26:13 +01:00
tp_smapi
tunctl
uclibc
udev
udisks
untie
upower upower: Update to 0.9.18 and enable systemd support 2012-08-21 08:42:44 -04:00
upstart Remove a bunch of unreferenced files 2012-11-29 13:43:37 +01:00
usbutils usbutils: Update to 006 2012-09-28 23:20:59 -04:00
util-linux
v4l-utils
v86d
wireless-tools
wis-go7007
wpa_supplicant wpa_supplicant: upgrade to 1.0 2012-09-09 13:04:13 +02:00
wvdial
xf86-input-mtrack xf86-input-mtrack: Update, use pixman 2012-07-14 16:32:20 -04:00
xf86-input-multitouch
xf86-input-wacom xf86-input-wacom-0.16.0 2012-08-26 22:38:15 +04:00
xf86-video-nested Update xf86-video-nested to work on current NixOS Xorg 2012-11-17 20:03:34 +01:00
xf86-video-nouveau
zfs ztest: fix hardcoded paths 2012-12-04 14:08:34 -08:00