« first day (1286 days earlier)   

12:00 AM
OK, that's what I was wondering. Why is bash not POSIX?
it's the read -d feature which isn't in POSIX
a shell can have it, but it doesn't have to
I don't know offhand what bash lacks
@Gilles Yes, I understood, which made me wonder whether having extra features makes you non POSIX
I might post a question about that. I'll see if I can find out before Stephane answers :)
@Gilles I will just remove that part if read -d isn't POSIX, I thought it was. I'm not sure there is a reliable way to do it POSIXly
@Graeme there is in principle, but it's very difficult, because none of the text processing tools are required to accept null bytes
And here was I thinking I was clever with sed "$ "\!"N; $ { s/'/'\\\''/g; s/=/='/; s/$/'/ } "
12:06 AM
@Graeme Heh, you were, that's nice!
Apparently not clever enough, but clever nevertheless.
@Gilles I think it is more that some of the extra bash features wind up breaking POSIX conformance. You can run with --posix though.
@Graeme you need to use --posix, sure, but even that isn't enough
@Graeme The link I posted above gives all reasons.
> There is other POSIX behavior that Bash does not implement by default even when in POSIX mode. Specifically:

The fc builtin checks $EDITOR as a program to edit history entries if FCEDIT is unset, rather than defaulting directly to ed. fc uses ed if EDITOR is unset.
As noted above, Bash requires the xpg_echo option to be enabled for the echo builtin to be fully conformant.
Bash can be configured to be POSIX-conformant by default, by specifying the --enable-strict-posix-default to configure when building (see Optional Features).
Trap handling is probably broken, only ksh gets it right
@Gilles You mean this?
> 46 The arrival of SIGCHLD when a trap is set on SIGCHLD does not interrupt the wait builtin and cause it to return immediately. The trap command is run once for each child that exits.
12:09 AM
@terdon so you need build options, good to know.
@Graeme Apparently
12:27 AM
A: How do I source another process's environment variables?

GillesIn this answer, I assume a system where /proc/$pid/environ returns the environment of the process with the specified PID, with null bytes between variable definitions. (So Linux, Cygwin or Solaris). Zsh export "${(@ps:\000:)$(</proc/$pid/environ)}" Bash, mksh while IFS= read -r -d "" PWD; do...

I didn't find a non-Rube-Goldberg way of dealing with null bytes posixly
12:39 AM
@Gilles Could you explain the zsh magic please?
@terdon edited
@Gilles Thanks.
Your bash one seems to fail on exporting newlines
It will export the entire variable correctly but seems to convert a newline to a space.
Nope. Sorry, quoting idiocies on my part.
1:00 AM
@Gilles: . <<ENV /dev/stdin\n$(cat </proc/$pid/environ)\nENV\n
Kinda rubey. too, I guess.
If that doesn't handle null just add |sed -z or similar.
I think the subshell should handle the \0 though.
So probably: . <<ENV /dev/fd/0\n$(echo 'IFS=' ; cat /proc/$pid/environ ; echo 'unset IFS')\nENV\n could get it. It's the same as set, right?
speaking of which...
1:18 AM
@mikeserv completely broken since the entries in environ are null-separated, not newline-separated
@mikeserv sed: invalid option -- 'z'
`. <<ENV /dev/fd/0\n $(tr '\0' '\n' <proc/$pid/environ)\nENV\n
I have no idea what you're trying to do here, but it's not helping
Sorry - its not easy on the tablet. I do suspect though that if you put that in sh the \0 wouldn't pass the subshell.
You don't have -z? Weird - I got that.
@Gilles you should look again. Don't know why I didnt think of tr in the first place. If you havent already noticed - I'm a little dense sometimes. But I am persistent.
@mikeserv and what happens to values that contain newlines?
you can swap newlines and nulls with tr '\0\n' '\n\0'. It's a useful trick sometimes. But then you need to find a way to manipulate the data that works even when there are null bytes.
All GNU tools are null-safe, but POSIX doesn't mandate it
No need.
It doesn't come quoted?
I know that. But I thought the environ file was quoted?
As long as the values are quoted the here-doc won't do anything to the newlines.
1:32 AM
@mikeserv no, it's just null-separated records
why would it be quoted?
it has nothing to do with the shell, it's a kernel interface
Damn. I guess I'm thinking of set. So you'd have to do it with used after all -
I know that, I just still thought it came quoted.
Still. . <<ENV /dev/stdin\n$(sed '$!H;${x;/\(^\|\x00\)\([^=]*\).\([^\x00]*\)/s//\1="\2"\n/g}')\nENV\n
That might do it.
I dunno. Its hard enough typing it on the tablet, much less testing it.
@mikeserv I don't think so. What if a value contains "?
Oh, then I guess you use \x47 instead.
that's not the issue
you're barking up the wrong tree
heredocs won't help you there. Sure, you can use a heredoc, but a string will do just as well.
I had to throw in the towel on this one. The solution can be done with a combination of @Gilles tr trick and sed -n l. If you then pipe to a long sed script, read each line and pass it through printf and eval you will get it.
1:45 AM
OK. It would be better to save the ENV with set when the process is invoked of course. You wouldn't need to do all the parsing. Its served on a quoted silver platter.
Gilles used tr too?
A heredoc will help because it won't screw up the quotes and .dot can read a file.
I think the above should do it all thought.
If you use \x47 instead of "
Sorry. That's octal. \x27
You could use a pipe too - but then how do you get it in the current environment? Guess you could set it on the other side of the pipe then output set
@Graeme you're still assuming that sed passes null bytes through unscathed
in which case, you might as well assume a null-safe awk and save yourself a lot of trouble
What's that mean?
What's the link?
have you programmed in C?
C uses the null byte as an end-of-string marker
old Unix utilities just read lines as strings. If a line contains a null byte, it effectively marks the end of that line.
POSIX doesn't require any of the text utilities to cope with null bytes in the input
No way. I can interpret some of it - I know null means end though. That's why the subshell will strip it for you. Well, not in ash though.
Zsh that is.
zsh is the only usual shell that copes with null bytes in strings
1:52 AM
<3 zsh
I know. That's why I suggested you try the cat thing in sh. But it doesn't handle the quotes. Still, it gets a lot easier after that.
I think `sed` is required to be null safe in this case. The POSIX manual says:

>Escape Sequences and Associated Actions ( '\\', '\a', '\b', '\f', '\r', '\t', '\v' ) shall be written as the corresponding escape sequence; the '\n' in that table is not applicable. Non-printable characters not in that table shall be written as one three-digit octal number (with a preceding backslash) for each byte in the character (most significant byte first).
2:06 AM
Probably : sh <<\CMD\n ( tr '\n' '\\n' </proc/environ ) | sed '/^([^=]*).(.*)/s//\1=\x27\2\x27/;s/\\\\n/\n/g'\nCMD\n
PSA: I've just added "use this tag for questions not applicable to other distributions" to the end of .
That's probably pretty close to getting set equivalent output. Safe the newlines with tr instead of the nulls and let the subshell strip those for you. It's one idea. Still, its much better to do at process launch - then all you have to do is ENV=set and eval it later whenever.
sound OK? if so I'd like to add it to other distribution tags (e.g. , , etc.)
That's a great idea.
ok, I'll add it to the other wikis
I like how @slm is in the top answerers for Debian but he doesn't even use it
2:11 AM
Well, he's a very active answerer and its a very active topic, but I appreciate the irony as well.
Yes for shame everyone that uses Debian. I've only booted it for the first time ever in the last month or so.
in VM
I've only ever used RH, SuSE, Mandriva, Mandrake, and Slackware
pretty much everything but Debian/Ubuntu. My wife and kids use Ubuntu.
The nicest OS I've seen though is PCLinuxOS
@slm <troll>everything but Debian, Ubuntu and the best distribution of all</troll>
you forgot Gentoo and LFS too
Yes i forget about Arch
but I see your point :P
I used Gentoo too
2:15 AM
@slm really? how was it?
I'm still waiting for it to compile 8-)
also: no reason to keep and , right?
gentoo was very nice but building from src was a pain to me
sabayon is a nice compromise
but I like living on contents not islands
I really want to try Gentoo, but I'm afraid that I'll like it and then I'll spend way too much time waiting for compilations. #gentoo
That reminds me - @Graeme - did you ever get Terminology to come together?
2:22 AM
@mikeserv nah, not yet. I built it with the Debian e18 libs but no dice. I turned out that elementary was actually e17, so I compiled that one from source. Still no dice. I think I need to do the whole lot from source. Or just wait until someone gets around to packaging it.
@strugee If you like Arch I would assume you'll like Gentoo. The install to me was a pain to get started, not very clear, but it was nice and fast once you took the time to build things. I eventually gave up on it though, the building is just too painful to me
I think you do too - they're chatty builds, but super easy.
@slm I think so too
I want to do something like I did with that btrfs seed / tmpfs hack but as a package manager.
Essentially all a package manager does is tell the filesystem where to put what file. If it could be handled by the filesystem...
Still, I'm way too lazy to see anything like that through.
And dependency tracking of course, I guess, but that could be tracked in the filesystem too.
With subvolumes.
@mikeserv I have no idea what you're talking about, because I only vaguely remember you talking about that. but you should look into OSTree
it might be vaguely what you're talking about. I don't know.
2:33 AM
@mikeserv, here is the error I get from `terminology`:
`CRI<7081>:elementary elm_win.c:2858 _win_constructor() Software X11 engine creation failed. Trying default.`
Any ideas?
holy shit. it happened.
look at MSO:
(aaand that's the same image)
@strugee yeah, they are still iron out bugs
if you want rep in MSE, just ask :P
@Graeme - mostly that you should just do the whole build.
@Braiam :P
Sorry. It's just - that's how I did it.
2:51 AM
Yeah I would like it to work with as many packaged sources as possible. The more stuff you compile, the more deps you end up having. When they get upgraded, you end up having to recompile. Is a pain in the ass.
3:24 AM
I would generally agree, but their builds are pretty self contained.
@Graeme - I found that one post - is it just me or is there pretty much nothing in /proc/1/environ anyway?
@slm, I see some pretty backward logic here - unix.stackexchange.com/questions/125155/pattern-matching/…
@mikeserv nope not much there, are you still thinking about parsing enviroments?
@Graeme - I would've done it exactly the way you suggested. I asked the OP about it as well. He seems to be having issues with he file sizes though.
@slm he probably wants to match in the first column (although I have a feeling he doesn't even realise it). I was just left squinting when he said he didn't want to use grep because of the other solution.
@Graeme Yeah that made little sense to me as well
Not as if you can add these things called arguments that massively change the way a program behaves or anything.
3:31 AM
Jason found a dup anyway, you answered on the dup too 8-)
I don't understand why he's asking how to do this from a perl program either
oh well, slow night when we're fighting over answering these gene Q's 8-)
Yeah, been quite slow on here all day today I think. Nevermind, its way past my bed time anyway I was gonna call it a night before I saw that and thought "that's easy". This time though...
Q: Downgrade USB 3.0 to USB 2.0 in ubuntu

user2622247I have USB 2.0 device when I plugged this device into the USB 3.0 port of my system then system gets hanged, after researching many of the solutions says that you can downgrade USB 3.0 to USB 2.0. But I didn't get any specific documentation for related to downgrading process. How can I downgrade...

When he says downgrade the ports, is there no way to force the USB 2 driver to be used for a USB 3 port?
Of course. Not much? Mine is only TERM=Linux
@Graeme I'm betting that's set by a file.
@mikeserv I get a few more than that BOOT_IMAGE is one.
@slm - what's in your /proc/1/environ?
I still think my sed thing would do it with any one. But now I'm wondering what the hell is so special about this guys proc/1/environ.
BOOT_IMAGE=/vmlinuz-3.13.7-100.fc19.x86_64LANG=en_US.UTF-8RD_TIMESTAMP=1397222729129935 2356578PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
3:45 AM
I answered another question of his earlier today. Well...
If you'd call it an answer. It was a man copy/paste.
Now thats useful. Thanks @slm and @Graeme.
@Graeme I had the same thought too, but didn't see a way to do this.
@Graeme - lshw shows the drivers being used for the various hardware
on my USB2 only laptop
         configuration: driver=ehci-pci latency=0
@slm I'm just wondering what happens if you run an old kernel on a machine with USB 3. Does it fail to recognise the ports at all or does it just treat them like USB 2?
The only thing i could conceive of was perhaps the ehci-pci would take switches
               capabilities: usb-2.00
is shown in my output
The USB 3 driver is xhci_hcd AFAIK
You could always try hiding the module
I don't have any USB 3's handy
You can usually pass options to the drivers, I'm guessing you could tell the xhci_hcd driver to only allow for 2 capabilities
3:52 AM
I get all three drivers showing up when I do lspci -v
ohci-pci, ehci-pci and xhci_hcd
I think different ones are used depending on what is plugged in
You could try hiding /lib/modules/3.13-1-amd64/kernel/drivers/usb/xhci-hcd.ko and see what happens.
Anyways, done for today.
I don't have these drivers
4:18 AM
@Graeme depends on the application.
Many usb3 applications are actually PCI addons.
Those generally fail entirely.
But truly on-board usb3 applications should be managed to some degree by the firmware and so you'll get USB2 functionality.
@slm's showing off his nearly up to date kernel to all of these Debianers.
I'm still on 3.13 too I think.
4:36 AM
I cannot find the module xhci_hcd. Puzzled as to why this would be missing.
Do you have usb3?
Don't mean to insult. Its just a habit to ask stupid questions.
no i don't
$ sudo modprobe -r xhci_hcd
modprobe: FATAL: Module xhci_hcd is builtin.
Would seem that this module is builtin
I meant the hardware.
You might have the other one...
Forget what its called.
nope no usb3 hardware
Starts with an e I think.
4:41 AM
Well. Why would you have xhci then?
No. The brand actually.
Ethernet. Haha.
Sorry I was looking for the kernel module on disk I wanted to interrogate it to see what capabilities it had (i.e. what options it would accept)
Well, do you have the header files? Don't know why modprobe or udev would source it for you if you don't have the hardware. Get the headers though and you should be able to play around with all of the modules.
4:45 AM
I like using modinfo <mod> for the param listings
4:56 AM
Did it work then? Definitely sorted /proc/$$/environ
Don't know why Gilles thought it wouldn't work, but it handles everything I throw at it.
. <<ENV\n$(sed -rn 'H;${x;s/(^|\x00)([^=]*.)([\x00]*)/\2\x27\3\x27\n/gp}' /proc/self/environ)\nENV\n
Anybody know why that might fail?
It handles terminal escapes and newlines special shell characters for me anyway...
Though it should be . <<ENV /dev/stdin
And the last bit should be [^\x00]*
5:30 AM
hmm, Fedora's restructuring looks interesting and promising. blogs.gnome.org/uraeus/2014/04/16/…
@slm ^
anyway, bedtime now. night all.
@strugee - thanks for the link, was just reading it, looks interesting
1 hour later…
7:08 AM
@Graeme no, that's about all the other non-printable characters
Text File

A file that contains characters organized into one or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the <newline>. Although IEEE Std 1003.1-2001 does not distinguish between text files and binary files (see the ISO C standard), many utilities only produce predictable or meaningful output when operating on text files. The standard utilities that have such restrictions always specify "text files" in their STDIN or INPUT FILES sections.
6 hours later…
1:03 PM
Does anyone have any idea about this?
Q: how can I change what the command "apt-get update" looks for when executing the update?

Space GhostForgive my incompetence I am still new to GNU/Linux. I use Debian wheezy. When I type apt-get update I get this at the end W: Failed to fetch http://ppa.launchpad.net/webupd8team/java/ubuntu/dists/wheezy/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/webupd8...

There is a launchpad source that is showing up in apt-cache policy and apt-get update, but the poster claims it is not there in /etc/apt/sources.list and /etc/apt/sources.list.d.
1:17 PM
@FaheemMitha posted something
1:46 PM
@Braiam Doing a grep makes sense.
As @Braiam, suggests, try doing a grep. I'd actually suggest just a grep -Ri launchpad /etc/apt/. — Faheem Mitha 38 secs ago
As @Braiam, suggests, try doing a grep. I'd actually suggest just a grep -Ri launchpad /etc/apt/. Or even cd /etc/apt. And then grep -Ri launchpad *. — Faheem Mitha 2 mins ago
2:02 PM
All, I am about to board a plane and can't help with this Q which I caused to be migrated here, could somebody have a look?
Q: SSH Write Failed: Broken Pipe

emisferaI used to be able to connect via ssh (terminal) with the user I have created but now I keep getting: "Write Failed: Broken Pipe" and I can only connect as root In the ssh auth.log I get the following: Accepted password for username from port 49999 ssh2 pam_unix(sshd:session): sessio...

@terdon the answer
1 hour later…
3:16 PM
@terdon Going somewhere?
3:26 PM
@mikeserv so you're a Red Dwarf fan too?
4:23 PM
Q: What does exit 99 means?

Java_AlertI'm new to Unix. Just want to know what is exit 99 and why would one use it and what are the significance uses of it. For example, I'm using exit 99.

saw this in the hot questions list and I was really excited for it to be super interesting but it's actually just the dumbest question
4:44 PM
@FaheemMitha I just finished Cryptonomicron
4:56 PM
@casey How was it?
I think it kinda went off the rails at the end. I liked it though. It was interesting how all of the characters were linked, but not sure I'd be a fan of more than that after looking at the bundled excerpt of the Baroque Cycle in my ebook.
@FaheemMitha I liked anathem better.
5:13 PM
@casey I see.
@casey ever tried Vernor Vinge?
@mikeserv I think that should be Debianistas.
@FaheemMitha nope
@casey Ah. Well, Marooned in Real Time is a pretty good novel.
Marooned in Realtime is a 1986 murder mystery and time-travel science fiction novel by American writer Vernor Vinge, about a small, time-displaced group of people who may be the only survivors of a technological singularity or alien invasion. It is the sequel to The Peace War (1984) and "The Ungoverned" (1985). Both novels and the novella were collected in Across Realtime. Marooned in Realtime won the Prometheus Award in 1987 and was also nominated for the Hugo Award for Best Novel that same year. Plot summary In the story, a device exists which can create a "bobble", a spherical ...
And Fire Upon the Deep is also pretty good. And pretty famous.

« first day (1286 days earlier)