HNHacker News
TopNewBestAskShowJobs

Hello71

1,909 karma · joined September 24, 2012

submissionscomments
Hello71··on Life at 800 MHz
> Via TLP on Linux, I've been capping my laptop's CPU (i7-8665U) to 800Mhz whenever I'm on battery.

in most cases, on modern hardware, limiting the frequency significantly below its nominal maximum will reduce battery life. for a fixed amount of work (e.g. parsing an HTML document), it is more efficient to complete the task as quickly as possible then return to a low-power state. the picture gets somewhat murkier when considering increased voltage requirements at higher clock speeds and certain fixed-wakeup workloads, but the majority of scheduler tuning for battery-powered devices over the past decade has been towards going to sleep as quickly as possible, even if that requires a high peak frequency.

Hello71··on Beej's Guide to Unix IPC (2015)
> For some handle types like sockets, for hardware reasons (multicore CPUs) Linux no longer guarantees sequential file descriptors.

huh? this would be a severe POSIX violation, which says that for socket and accept, "The file descriptor shall be allocated as described in File Descriptor Allocation.": "All functions that open one or more file descriptors shall, unless specified otherwise, atomically allocate the lowest numbered available (that is, not already open in the calling process) file descriptor at the time of each allocation."

Hello71··on Why might you run your own DNS server?
I don't run DNSSEC either, but as you know, the Slack issue was caused by haphazard implementation, followed by apparent panicked incorrect rollback. They would have had basically the same issue if they had added incorrect AAAA records with long expiry. There may well be reasons not to deploy IPv6, but I don't think this is a good one. Similarly, while I agree that DNSSEC offers few upsides, I don't think this particular example is a good one against DNSSEC itself.
Hello71··on Do we need a link step?
The vast majority of these programs are not ordinarily linked in a single DSO though; KDE and the Linux kernel for example are well-known for containing very large numbers of DSOs. I am also skeptical of this methodology: checking the first project, KDE, on the linked source, Open Hub, it says there are 19 million lines of code, not 58. Of those, only 63% are in C++, with 16% in XML, 6% in PHP (?), etc, which would presumably not count towards a linking cap.
Hello71··on Japan HP accidentally deleted 77TB data in Kyoto U. supercomputing system
> So I guess bash or whatever does an mmap of the script it’s running

this is incorrect, and is relatively easy to test:

  $ strace -y -P /tmp/test.sh bash /tmp/test.sh
  ioctl(3</tmp/test.sh>, TCGETS, 0x7ffc6daea580) = -1 ENOTTY (Inappropriate ioctl for device)
  lseek(3</tmp/test.sh>, 0, SEEK_CUR)     = 0
  read(3</tmp/test.sh>, "#!/bin/sh\n", 80) = 10
  lseek(3</tmp/test.sh>, 0, SEEK_SET)     = 0
  dup2(3</tmp/test.sh>, 255)              = 255</tmp/test.sh>
  close(3</tmp/test.sh>)                  = 0
  fcntl(255</tmp/test.sh>, F_SETFD, FD_CLOEXEC) = 0
  fcntl(255</tmp/test.sh>, F_GETFL)       = 0x8000 (flags O_RDONLY|O_LARGEFILE)
  newfstatat(255</tmp/test.sh>, "", {st_mode=S_IFREG|0644, st_size=10, ...}, AT_EMPTY_PATH) = 0
  lseek(255</tmp/test.sh>, 0, SEEK_CUR)   = 0
  read(255</tmp/test.sh>, "#!/bin/sh\n", 10) = 10
  read(255</tmp/test.sh>, "", 10)         = 0
the reason why modifying a script during execution can have unpredictable results, not demonstrated in this test, is that Unix shells traditionally alternate between reading commands and executing them, instead of reading the entire file (potentially very large compared to 1970s RAM size) and executing commands from the in-memory copy. on modern systems, shell script sizes are usually negligible compared to system RAM. therefore, you can manually cause the entire file to be buffered by enclosing the script in a function or subshell:

  #!/bin/sh
  main() {
  # script goes here
  }
  main
Hello71··on Japan HP accidentally deleted 77TB data in Kyoto U. supercomputing system
> In the US, an apology is considered an admission of responsibility and is often the starting point of legal action against the culprit

source? this is a popular theory among non-lawyers, but not, as far as I can tell, well-supported by the evidence. http://jaapl.org/content/early/2021/05/19/JAAPL.200107-20 has extensive citations including for their claim that "In theory, telling a patient about an error may make patients more likely to pursue litigation. In practice, however, bad outcomes alone are typically not reason enough for patients or their families to file malpractice claims."

Hello71··on Glibc is still not Y2038 compliant by default
musl has lasted almost one-third as long as glibc, with significantly less than one-third the number of ABI breaks. as far as I know, the only musl ABI break has been time64; despite glibc's supposedly superior version handling, musl has completed time64 support with headers only, whereas glibc is still in progress.
Hello71··on Microsoft forked MIT licensed repo and changed the copyright [fixed]
is it possible that microsoft bought the rights to the software
Hello71··on Installing Windows and Linux into the same partition
in classic Microsoft fashion [0], WSL1 is not officially abandoned, but seems to be planned to be left in half-finished mode forever. bugs are closed as "fixed-in-wsl2" without further comment: https://github.com/microsoft/WSL/issues?q=label%3Afixed-in-w..., including serious bugs causing incorrect computations: https://github.com/microsoft/WSL/issues/830.

[0] see the dozens of official Windows GUI frameworks: https://news.ycombinator.com/item?id=16736720 (and since then, it's gotten worse: https://www.google.com/search?hl=en&q=uwp%20deprecated)

Hello71··on Oracle's JDK 17 – Free Again for Commercial Use
looking at last 1000 commits to gcc, it seems like about 80-90% of emails are associated with "big corps". however, this doesn't tell the whole story. according to https://lwn.net/Articles/867540/, over 85% (100%-6.8%-5.0%-1.6%=86.6%) of Linux kernel changesets are supported by employers, but nobody sensible would claim that Linux is not community developed. whether it is because of historical project culture, or BDFL, or simply a large number of contributing organizations, there is clearly a substantial difference between Linux and OpenJDK development methodology.
Hello71··on Oracle's JDK 17 – Free Again for Commercial Use
i don't think that's consistent with history. there used to be a large number of Java implementations; by far the biggest reason why they (almost) all died out is because Sun agreed to open up their implementation. IBM still maintains J9, and while that's only part of a full Java implementation, I don't see any reason why Apache Harmony or GNU Classpath couldn't be revived and combined with it for a high-performance Oracle-less Java implementation. there is major precedent for this in the form of GNU/Linux, where substantial parts of the userspace are provided by GNU, but the kernel is a separate project.
Hello71··on FreeBSD switches the default root shell from csh to sh
unless you're exclusively running shell built-ins, doesn't running any command at all potentially cause a disk scan
Hello71··on Automatic CPU speed and power optimizer for Linux

  echo power | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
Hello71··on Windows 11’s first update makes AMD CPU performance even worse
But Microsoft can do that too? They can compile one version of each DLL for SSE2 and another for AVX or whatever if they want, same as any other vendor. It's not like they can just turn off SSE2 for everybody, because it would break every program, and even new programs may use SSE2 instructions in combination with newer x86 extensions. Even if they did (and I'm not sure it's even possible in x86), I don't see how it could increase security anyways; any new Spectre vulnerability or whatever is probably going to be just as exploitable if not more so using AVX load instructions as SSE load instructions.
Hello71··on Windows 11’s first update makes AMD CPU performance even worse
I'm not sure I buy your point about ISA extensions. Many programs still target Windows XP or Windows 7, and if that "lag" remains the case, then it will be many, many years until vendors can reasonably require Windows 11 as a proxy for those ISA extensions. In the meantime, vendors can offer a Windows XP-11 version, and a Windows 11 "optimized" version, but at that rate, it would be just as much work to put the optimizations in the single version and make the program automatically detect the CPU, saving the user the trouble of figuring out which version they need while also making the CPU optimizations work on older Windows versions.
Hello71··on Tiny ELF Files: Revisited in 2021
The original article is extremely clear on this fact.

The title:

> A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux

as opposed to ELF Executables for non-Linux systems, or a.out executables for Linux. In the middle of the article, when the illegal shenanigans start:

> Unless, that is, we could change the contents of the structures to make them match even further....

> How many of these fields is Linux actually looking at, anyway? For example, does Linux actually check to see if the e_machine field contains 3 (indicating an Intel 386 target), or is it just assuming that it does?

At the end of the article:

> Of course, half of the values in this file violate some part of the ELF standard, and it's a wonder that Linux will even consent to sneeze on it, much less give it a process ID. This is not the sort of program to which one would normally be willing to confess authorship.

I don't see how the author could possibly be any clearer that this is Linux-specific and will probably not work (unmodified) on non-Linux systems.

Hello71··on “Static Linking Considered Harmful” Considered Harmful
ld isn't the dynamic linker either, it's the object linker. the name of the dynamic linker is ld.so or ld-linux.so. this is also documented in the ldd man page.
Hello71··on Ask HN: Who is hiring? (October 2021)
duplicate of https://news.ycombinator.com/item?id=28720338
Hello71··on Fun with Glibc and the Ctype.h Functions
> all the world is not Linux or BSD

since when does glibc run on bsd

Hello71··on Ask HN: Who wants to be hired? (October 2021)

  Location: Toronto, Canada
  Remote: Open to
  Willing to relocate: Yes
  Technologies: C, Python, shell, Linux, git
  Résumé/CV: https://www.alxu.ca/resume/
  Email: see resume
Hello71··on Apple didn't revolutionize power supplies; new transistors did (2012)
the first sentence of the article:

> The new biography Steve Jobs

it was a response to the new biography.

Hello71··on Teaching a cheap ethernet switch new tricks (2019)
Normally, terrible. These systems are built with anemic, usually single-core CPUs usually in the low 100s MHz. The only way they can actually do gigabit switching is by hardware offload to dedicated ASICs. Anything going through the main CPU, even without encryption, will have terrible performance.
Hello71··on Imaging mounted disk volumes under duress
If you can pause writes to the disk while reading from it (and you are using a supported filesystem, and you aren't doing or can ignore any raw device accesses), it would be much easier to use fsfreeze(8) instead. Caution is of course required when using this on the root filesystem, but I would trust it far more than anything using blktrace. My guess, having used it before but not closely investigated it, is that while it may appear reliable at first, it is most likely not highly tested to drop no events under load, and the same applies for this tool. On the other hand, as long as I've worked out that fsfreeze won't deadlock the whole machine, I'm reasonably confident that it will result in a correct disk image.
Hello71··on Video streaming battery life improved from 12h (12 Pro Max) to 25h (13 Pro Max)
According to https://tradingeconomics.com/country-list/sales-tax-rate?con..., out of G20 countries, 16 have sales tax rates greater than or equal to 10%. This seems to only counts national sales tax, since it lists 5% for Canada, but about 85% of Canadians live in areas with more than 10% total sales tax.
Hello71··on Large Unix programs were historically not all that portable between Unixes
> uname -a

so whenever you upgrade the kernel or change CPU all your programs need manual patching? you may answer, "well uname -a was a joke, you would actually check the libc version". this worked alright in a very specific time period with a couple of big vendors with nigh-unmodifiable toolchains with well-defined release versions. it became increasingly awful when people started making their own toolchains with free software and had to patch every single piece of software to properly detect their new libc. sitting through an hour of autoconf sucks, but slogging through ten hours of patching poorly written bespoke configure scripts is a hundred times worse.

edit: not to mention cross-compiling where you can't even run uname -a, and which was almost universally broken before autoconf, which, despite being painful, made cross-compiling mostly work everywhere.

Hello71··on uBlock Origin review
> one-click "disable 1p CSS"

this is built in to firefox since it was netscape navigator, under view -> page style -> no style.

even the menu items have barely changed since then: http://www.alanwood.net/unicode/net7_encoding.gif

Hello71··on Illustrated Redirection Tutorial
> We don't really care what happens to fd3. But if we did, we could fix that by directing it to /dev/null at the end. Again, showing how important the ordering is.

it's good practice to close extra FDs for children who are not expecting it. poorly designed applications may misbehave if provided with unexpected additional FDs. you shouldn't use /dev/null for this purpose, but instead actually close it with 3>&-.

Hello71··on Man steals 620k photos from iCloud accounts from home without Apple noticing
even though you're probably right on the first part, the second part is false. while most NAT implementations operate as you describe, called "port-restricted cone NAT", some implementations allocate the external port only for a specific destination address, called "symmetric NAT".
Hello71··on Plane damaged after being hit by York police drone at Buttonville Airport
"officer-involved aircraft incident"
Hello71··on How to prevent email spoofing, using an unholy combination of silly standards
why can't you just periodically fetch and cache the records yourself? i.e. an ALIAS record for SPF. if the customer doesn't want to use dynamic dns, then you could even provide this service for them, of course charging a premium for the "enterprise feature".
← PreviousPage 5 of 33Next →