« first day (4129 days earlier)      last day (154 days later) » 

9:26 AM
Is it safe (for the hdd) to just cat dev zero to /dev/sdx?
trying to wipe clean an hdd before giving it away, not trying to protect against mossad
 
For spinning rust, yes.
 
Hmm?
Sorry, I didn't get that
 
If your disk is a spinning disk, not an SSD, then yes, it’s safe to cp /dev/zero /dev/sdX.
 
Oh, blatant SSDist discrimination! :P
 
For both SSDs and spinning disks, secure erase will avoid undue wear and tear and will put the data beyond the reach of the vast majority of people.
 
9:33 AM
Thanks, I did mean a cool magnetic thing
 
@AndrasDeak I suspected as much, I just wanted it to be absolutely clear!
 
And rightly so, thank you :)
 
@StephenKitt And if it's an SSD? Could cp /dev/zero /dev/sdX harm it?
I thought this thing about SSDs being too precious to actually be used for their intended purpose of reading and writing data was a thing of the past.
 
Sounds like one can overwrite less than all blocks to hide the data well
 
@terdon it won’t harm it, but it will use up one write cycle everywhere and give the block management system a vigorous workout; trimming or secure erasing would produce the same result without that.
 
9:41 AM
@StephenKitt I am pretty ignorant about this sort of thing. Why is giving the block management system a workout a bad thing? I mean, isn't that what disks are for?
 
The endurance of SSDs in the marketplace goes up and down, it’s a bit difficult to give a general rule. QLC and PLC have lower TBW ratings for example.
@terdon well, it’s unusual for disks to be written end-to-end quickly ;-). Manufacturers do take some shortcuts, so it’s hard to say “yes, it’s definitely safe to cp /dev/zero /dev/sdX on SSDs”, especially when there are better approaches.
The best solution for both HDDs and SSDs (and tapes, and cloud storage, and whatever else) is encryption. Then you don’t need to worry about anyone recovering the raw bits from a disk, as long as they can’t get the key...
For home use I would say anything goes on SSDs, you’re never going to run out of cell writes.
But I suspect many of us know sysadmins who treat their enterprise systems the same way they treat their home systems (and vice versa), and sysadmins who apply random trivia gleaned from forums and chats.
My 9-year-old Crucial m4, which sees a decent amount of activity (over 57TiB written), is only at 65% of its rated life...
 
Huh. Thanks
 
10:25 AM
@StephenKitt isn't encryption hella slow on an HDD?
 
@AndrasDeak why would it be slow? You end up reading and writing the same amount of data, it’s just different data...
 
because HDDs are slow, and en/decryption is more overhead
So yeah, I meant encryption plus HDDs, together
 
Well, my eight-year-old desktop can process AES-256-CBC at the rate of over 500MiB/s on a single core; my one-year-old laptop handles over 1GiB/s on a single core. So the cost of encryption/decryption is small compared to the I/O time on an HDD; adding encryption doesn’t significantly affect performance.
“Encryption plus HDD” is slow, but only because “HDD” is slow.
 
10:45 AM
Thanks, I'll try to remember that
 
@terdon Thank you for the feedback. Yes, I agree that SO seems like the most suitable choice. Though I don't know if it is necessarily off topic here.
 
in any case the HDD in question is not mine, I'm just doing a favour wiping it clean
 
1) OK, I'll look again, though I'm not aware of any other options. But I've only been using Python 3 for a short time. Which docs should one look at?
2) (Frame challenge?) Yes, I looked at it. And it works. Thank you, @JeffSchaller for the useful suggestion. But I still would like to know what is going on with pexpect. I don't see any option on the POP library for manually taking control of the session, so cannot compare that part directly.
Expect offers very general machinery, so it's useful to know about.
 
TIL that Asterix has a tag on SF&F — I never thought of Asterix as SF&F!
 
@FaheemMitha Do you need very general machinery? Don't you just want to download your email?
This is a very important question
a frame challenge is the nice way to ask if the other person has an XY problem
 
10:51 AM
@AndrasDeak Sure. There have been numerous instances in the past where knowing about such a thing would have been useful. But I only learned about Expect relatively recently, when I used it to answer another question.
 
Oh, I thought pexpect was also stdlib. This makes it even worse.
 
Having various sorts of machinery available is generally useful. And I don't go looking for things I don't understand. But if I don't understand them, I try to figure them out.
@AndrasDeak I'm not familiar with that terminology.
@AndrasDeak Worse?
 
@FaheemMitha That's a bit like saying that if you want bread it's better to buy the bakery because it gives you more options. But OK.
 
@AndrasDeak and the mill!
 
An example is relational databases, which I thought was complete rubbish for a long time. But when I was forced to learn about it through circumstance, I was able to use it, and it's been very useful.
@AndrasDeak Weird analogy, but that's your opinion.
@StephenKitt ?
 
10:55 AM
@FaheemMitha the documentation I meant was pexpect.readthedocs.io/en/stable/api/pexpect.html#spawn-class but apparently passing in the encoding you did is what you're supposed to do, so my hunch is probably wrong about where the error is coming from.
 
@AndrasDeak Not necessarily. I'll check on it now. But if not, I'll go ahead and post the question. It doesn't seem like complete rubbish. Of course that won't stop the SO folks from downvoting it.
 
It's a reasonable question but it doesn't have an MCVE due to the POP3 server stuff, so it's still a gamble how it will be received.
 
@AndrasDeak To be clear, the encoding is definitely the issue. It's worth checking on the sys.stdout thing.
@AndrasDeak MCVE?
 
@FaheemMitha but the docs I linked shows exactly what you're doing if you scroll down a bit
@FaheemMitha that's SOese for MWE
 
I can probably reproduce it without using POP. Let me check.
@AndrasDeak I've looked through the pexpect docs quite a bit.
@AndrasDeak What does MCVE mean?
 
10:59 AM
Do you know what MWE means?
 
@AndrasDeak Minimal Working Example, I think.
 
Yeah, it comes up a lot on tex.SE so I figured you might be familiar that one.
 
@AndrasDeak There is some relevant discussion on docs.python.org/3/library/sys.html
There doesn't seem to be a direct link to sys.stdout.
It seems to be saying that it picks up the system encoding, but I'm not sure.
> The encoding and error handling are is initialized from PyConfig.stdio_encoding and PyConfig.stdio_errors.
Trying to figure out how to check that.
> python -c 'import sys; print(sys.getdefaultencoding())'
utf-8
Interestingly, one of pexpect's own examples is exiting with an error.
faheem@orwell:/usr/local/src/pexpect/pexpect-4.8.0/examples$ python3 script.py
Traceback (most recent call last):
File "/usr/local/src/pexpect/pexpect-4.8.0/examples/script.py", line 114, in <module>
main()
File "/usr/local/src/pexpect/pexpect-4.8.0/examples/script.py", line 85, in main
fout.write ('# %4d%02d%02d.%02d%02d%02d \n' % time.localtime()[:-3])
TypeError: a bytes-like object is required, not 'str'
 
11:29 AM
@FaheemMitha that's great! Check if there's an issue with it already, and if not, open one
 
@AndrasDeak Will do.
 
0
Q: Pexpect interact() exception in python3

Kiran CherianI am in the process of learning Python so apologize if my question is naive. I was using the pexpect interact() in my script and it was working with python2.7. But when I use python3 or python3.5 I get the below error: Traceback (most recent call last): File "ap_access.py", line 73, in <module>

 
Maybe this version is horribly out of date.
@AndrasDeak Yes, I saw that one, and it appears to be similar, though I did not run his example. Perhaps I should.
 
Eh. It's the exact same issue as yours.
 
However, the answers appear to be nonsense, as far as I can tell. Though I'm not really familiar with these encoding issues.
 
11:32 AM
Oh, then there's no solution I guess ¯\_(ツ)_/¯
my bad
 
@AndrasDeak Thank you for reminding me of that question. I'd seen it earlier, but not paid much attention. Let me at least see if I can reproduce what he is getting. I'll also check for more recent versions. Unfortunately Debian isn't always good at keeping up.
 
Why not try the actual solution from the answer?
 
@AndrasDeak You mean std.stdout.buffer? I did. It doesn't work. Actually, it crashes immediately. Also, it makes no sense.
 
So why not lead with that?
 
@FaheemMitha Debian 11 has pexpect 4.8.0, which is the latest release
 
11:36 AM
@StephenKitt That's what I'm using.
 
"it appears to be similar, though I did not run his example. Perhaps I should."
"the answers appear to be nonsense, as far as I can tell."
"I'd seen it earlier, but not paid much attention. Let me at least see if I can reproduce what he is getting."
Don't you think "I've seen that question and the answer doesn't work, it even crashes immediately" would be something important to note?
 
@AndrasDeak I haven't actually tried running that user's example. I tried the "solution" in my own code, of course. Yesterday, I think. Along with other things.
@AndrasDeak Sorry. My bad.
 
@FaheemMitha yes, that's the expected procedure
not running code in questions is the right call usually
 
@AndrasDeak Well, it's OK as long as you read it and understand it first.
I run example code from the net all the time. But you need to know what it does.
Actual malicious code on forums is very rare, in my experience.
 
yeah, not all fora are as dangerous as the askubuntu chatroom :P
 
11:43 AM
Looks like this is an open issue, if I'm understanding correctly. Sigh.
 
yup, seems so
you can try applying the unmerged github.com/pexpect/pexpect/pull/539 :P
 
A list of things I didn't want to think about today includes Python encoding issues.
@AndrasDeak If I can understand what it's about.
 
you can always try poplib
 
Probably no point posting an issue on SO then.
And if it's so broken, perhaps I should stick with Expect. Though I don't really want to deal with Tcl.
 
@FaheemMitha it would be a duplicate of what I linked earlier
 
11:45 AM
@AndrasDeak I already did. Like I said, it works.
@AndrasDeak It would be, yes.
 
there's a workaround in github.com/pexpect/pexpect/pull/539#issuecomment-1015927720 that uses an actual file for logging, for what it's worth
 
> pexpect implemented workaround for writing to stdout in the method defined above, but not for logfile.
Not sure what that means.
 
pexpect's last commit was in April :/
@FaheemMitha sounds like the same error used to happen in other situations, that was patched (special-casing stdout, probably), but the same was not done for logfile handling
for what it's worth the PR's fix seems like a no-brainer github.com/pexpect/pexpect/pull/539/files
 
@AndrasDeak Oh, I see. He means it's still unfixed for log files?
 
but you're using system-installed pexpect so you shouldn't really mess with that
@FaheemMitha that's how I read it.
 
11:48 AM
@AndrasDeak I wonder why it hasn't been fixed, then.
 
@AndrasDeak I could patch and rebuild the Debian package, but it doesn't seem to be worth the trouble.
 
ah, yes, the PR's "fix" hard-codes utf8 encoding, that's bad
but if you're going to hack your local copy you can do whatever you want, e.g. use sys.getdefaultencoding which is probably OK most of the time anyway
 
Also, doing unofficial patches isn't a great idea.
 
@FaheemMitha oh yeah, you like doing that
 
11:50 AM
@AndrasDeak Not really. But I do it sometimes. But only for official patches.
 
as an alternative to editing a single line in a single file :P
(OK, two lines)
 
@AndrasDeak Well, that would get lost in the next upgrade.
 
true, but it's not like pexpect is being maintained anymore
 
I thought it was user error, because it seemed like pretty basic functionality to not be working.
@AndrasDeak It isn't?
 
It could be, but as I said the last commit was made almost a year ago
That's usually not a great sign, especially with 180 open issues and 19 open PRs. It's not like there's nothing left to do.
 
11:52 AM
@AndrasDeak Yes, I see that. Not encouraging, certainly.
@AndrasDeak Agreed. Emphatically.
Fine, I will now return to my regularly scheduled programming, because it doesn't look like there is anything to be done here.
@AndrasDeak Thank you for the assistance.
Making a mental note that trying to use pexpect for real work will probably not end well. Which is a shame.
 
last release almost exactly 2 years ago
 
The poster appears to be asking two questions in one. The first one, the issue with interact appears to be an open bug. See github.com/pexpect/pexpect/issues/506 It does not look like Pexpect is a very active project, so it's unclear when this will be fixed. The issue itself is from 2018. — Faheem Mitha 22 secs ago
I wonder if a comment is appropriate. But I can't think of anything else to do.
 
yeah, that's all you can do
 
The TeX people try to take care of abandoned projects. At least fix the bad bugs. But I guess they're in a minority. Most communities don't try.
Though the TeX community is special in a number of ways.
 
If there's a low bus factor and a maintainer meets a bus it's hard to carry on. It's enormous responsibility to pass on maintainership of a python project, because the maintainer can add malware any time they want, affecting all downstream users. I've seen more than one project where the maintainer said "I have to stop carrying this project, and all 3 people I would trust with it said no"
 
12:08 PM
@AndrasDeak Agreed.
 
 
3 hours later…
2:44 PM
Anyone know how to prevent LibreOffice from changing text (I.e. When I write SOkAL, it changes it to SokAL, but I want SOkAL)
Have figured it out before, but suppressed from memory :P
It's annoying as ... something
 
@ibuprofen Tools / AutoCorrect / While Typing
 
Thanks, perhaps something new. Do not have it 6.0.7.3 - but found another setting :),
Removed the Correct TWo INitial CApitals
 
 
5 hours later…
7:41 PM
hah, that's one of the less annoying autocorrections, IMO
 
8:28 PM
The getmail documentation is using the terminology ~USER. Anyone know what that signifies?
Probably something stupidly obvious.
OK, I came across this randomly on SO when doing a search.
> git-config will expand leading ~ to the value of $HOME, and ~user to the home directory for the specified user.
That's probably what it means.
I've not come across this previously, though. Is it standard notation?
 
yes: " ... the characters in the tilde-prefix following the <tilde> are treated as a possible login name from the user database ..."
 
8:45 PM
Home inspectors are flimsy. They have to much CYA verbiage in their reports
"Electrical panel is currently on fire which in my opinion is not ideal but you should contact an electrician to be sure"
 
in a hot housing market, they're probably just happy to have work!
 
@FaheemMitha in bash ~user expands to /home/user, yes
 
(or whatever the user has configured as their home directory, yes) :)
 
yeah yeah yeah :P
I press the button and the computer lights up
 
it's a good day
just don't try opening any cans
 
8:49 PM
@JeffSchaller, @AndrasDeak Wow, I must have missed that in 25+ years of using Unix. Live and learn.
 
@JeffSchaller fair point though, because I only use that syntax on computer clusters where the home is usually not in /home
 
It seems a little gratuitous in that example of fetching mail, since I'd think $HOME or ~ would suffice; but apparently you can download mail to someone else's home directory.
 
$ echo $HOME
/heart
 
I also didn't realise that ~ is actually replaced by $HOME.
 
a cluster of love, just in time for Valentine's Day! Your wife must be very understanding!
 
8:51 PM
@FaheemMitha don't you have a ~ in your shell prompt to that effect?
also scp must be a huge pain if you keep typing out full paths to homes
 
@AndrasDeak Probably. Haven't looked at it in a while.
 
@JeffSchaller ah, the two messages were unrelated :P
 
until
 
@AndrasDeak I know ~ represents home, I didn't realise it was explicitly the value of the env variable HOME. Or I've forgotten.
 
Ah, OK. What else could it be?
 
8:52 PM
if Stephen's been on your machine, it could be a subdirectory of $HOME!
 
Note to self: never let Stephen on my machine
 
Aug 9 '21 at 13:30, by Stephen Kitt
When I was a student a common trick for people who left their workstation unlocked was to create a ~ directory inside their home directory, and change their shell startup script to change to it — that way, on log in, their prompt would suggest they were in their home directory but they would see no files...
 
@AndrasDeak It could have been sourced a different way, that's all.
 
At least I know where to ask for help if I need to wipe a ~
 
9:04 PM
@JeffSchaller ahaha :) one more reason to have the full path in the prompt, not just the last part (or the full path starting from ~, like Bash's \w vs \W)
 

« first day (4129 days earlier)      last day (154 days later) »