Better HN
topnewbestaskshowjobs
Log inSign up

Hello71

1,909 karma · joined Sep 24, 2012 (14y ago) · 1,011 submissions

Submissions

comment 5y ago · link · parent

> 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>&-.

comment 5y ago · link · parent

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".

comment 5y ago · link · parent

"officer-involved aircraft incident"

comment 5y ago · link · parent

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".

comment 5y ago · link · parent

not only is this the first solution presented in the article, you've not even bothered to pass -layout to pdftotext or -u/-y to diff which would make this marginally workable. spaces after shebang also doesn't always work (e.g. in qemu), you don't clean up the temporary files, and the temporary files have unhelpful names.

comment 5y ago · link · parent

> If "git pull --rebase" succeeds without reporting a merge conflict, then it's tantamount to having executed the command with "--ff-only".

this is not correct. git rebase, as with git merge, will automatically resolve conflicts using a 3-way merge algorithm.

> It will only ever modify your local

this is correct.

> unpublished commits

this is not correct. git rebase (in its default mode) rebases all commits that are not upstream onto the upstream. it has nothing to do with whether they are published or not. if you have a published feature branch, and git pull --rebase into it, git rebase will dutifully rebase all your commits.

comment 5y ago · link · parent

as far as i can tell there's no git --configure. you may be confusing it with Xorg -configure, which is (very) obsolete and shouldn't be used.

comment 5y ago · link · parent

as pointed out in the reply, this is incomplete. there are actually three versions of inline in common use in C-like languages: gnu89, c99, and c++, which are all different.

comment 5y ago · link · parent

Commoditize Your Complement

comment 5y ago · link · parent

that's not how medians work. if 100 creators make $100 each, then the median income is $100. if you divide it again by 100, then you'll get $1/creator^2 which is a nonsense number.

comment 5y ago · link · parent

> © REDDITT/IMGUR

ah, daily mail...

comment 5y ago · link · parent

> full OS reboots

while it's theoretically possible for this to be caused by software, it seems more likely considering the other issues you've listed that there are some hardware issues here. linux drivers exercise the hardware differently from windows, and usually more efficiently. if your hardware is weak (particularly PSU), it can fail during intense loads. see: people blaming prime95 for crashing their computer.

comment 5y ago · link · parent

https://www.google.com/search?q=macos+send+ethernet+frames&h...

if you have root access, you should be allowed to have raw device access. the problem seems to be that apple no longer believes in users owning their computers, if it ever did.

comment 5y ago · link · parent

it looks like entr does a bunch of weird, potentially incompatible things, like redirecting stdin from /dev/tty and leaving FDs open in the child. however, my guess is that your build process is non-atomic, and your program is crashing due to necessary files being partially updated. this could probably be hacked around by doing something like `entr /bin/sh -c "sleep 1; exec realcommand"`.

comment 5y ago · link · parent

Huh? I just checked the Info-ZIP zip man page, and it says (reformatted):

> -g, --grow: Grow (append to) the specified zip archive, instead of creating a new one. If this operation fails, zip attempts to restore the archive to its original state. If the restoration fails, the archive might become corrupted. This option is ignored when there's no existing archive or when at least one archive member must be updated or deleted.

I tested this on Linux and it appears to work as advertised. I assume the reason why it is not enabled by default is because "If the restoration fails, the archive might become corrupted".

edit: python zipfile in append mode also appears to avoid rewriting the zip file. libarchive doesn't seem to support appending to zip files.

comment 5y ago · link · parent

At the risk of falling down an analogy rabbit hole, I'll be upset if the HVAC guy assumes that air will flow freely throughout the house and has no understanding of walls, or if the drywall guy blindly screws into my air ducts. No abstraction is perfect; some knowledge of the other layers is necessary to do a proper job. Unfortunately, in software, it seems like our abstractions are particularly leaky, and knowledge of other layers is frequently necessary to do a proper job. In house building, issues are usually contained by physical proximity, whereas the same is obviously not true in software, particularly networked software.

comment 5y ago · link · parent

it doesn't seem like it actually uses blockchain? according to https://en.wikipedia.org/wiki/Proof_of_personhood, it's basically PGP WoT but hopefully actually usable?

comment 5y ago · link · parent

> the CC0 Public Domain Dedication is GPL-compatible and acceptable for software.

comment 5y ago · link · parent

this reminds me of https://nautil.us/blog/impossibly-hungry-judges: google has the majority of github repos indexed (although isn't always great at giving you the best result), and webkit is a pretty popular software. unless this parameter was added to the codebase literally minutes ago, google should have at least some results. the fact that absolutely no results show up means that something is either wrong with google, or more likely, your query.

comment 5y ago · link · parent

as far as i can tell, the whole point of haikuos at this point is "fun". as pointed out e.g. at https://en.wikipedia.org/wiki/Haiku_(operating_system)#Criti..., haiku will never be a "mainstream" os. it seems plausible to me that riscv enablement is more "fun" than figuring out how to mangle crappy proprietary drivers enough to barely run.

comment 5y ago · link · parent

static can also make your code 10 times smaller: note that in the linked godbolt, there are actually two copies of both loop functions: one regular, and one inlined. this is because the compiler wants to inline the function, but is required to generate an additional one in case someone else will be calling it. what's more, at least on Linux, this copy cannot be removed from the final executable even if nobody calls it, unless a) the compilation is done with -ffunction-sections and the linking is done with --gc-sections, or b) LTO is enabled. adding static to the function declaration resolves this issue.

the situation is even worse with ELF dynamic libraries due to the interaction of two rules: a) by default, all functions are exported, and b) by default, all functions can be interposed, e.g. by LD_PRELOAD. here, if you specify -fPIC in the compilation arguments (as is required to produce a modern dynamic library), inlining is totally disabled. for small functions, the call overhead can be substantial.

comment 5y ago · link · parent

there's an easier way that doesn't require root and also doesn't break your environment variables:

  unshare -Ucn program

comment 5y ago · link · parent

https://github.com/mhagger/git-when-merged

edit: also https://stackoverflow.com/questions/8475448/find-merge-commi..., and also github shows this (but only for github PRs, not other merges)

comment 5y ago · link · parent

AMD64 supports only 48-bit addresses, and is still the most popular server ISA.

  You have: 2^48 byte
  You want: tebibyte
          2^48 byte = 256 tebibyte
          2^48 byte = (1 / 0.00390625) tebibyte
how many servers do you have with more than 256 TiB of RAM?

comment 5y ago · link · parent

it's not the main point of the article, but curl -X is being misused here. as the manual explains, "Normally you don't need this option. All sorts of GET, HEAD, POST and PUT requests are rather invoked by using dedicated command line options." https://daniel.haxx.se/blog/2015/09/11/unnecessary-use-of-cu... reiterates the issue, along with a reminder that -X persists past redirects (hope your API doesn't redirect to a completion page).

after searching for "PUT" in the manual, I found "-T, --upload-file <file> [...] If this is used on an HTTP(S) server, the PUT command will be used. Use the file name "-" (a single dash) to use stdin instead of a given file."

comment 5y ago · link · parent

> if you are protecting yourself from something that can access /proc (i.e. root)

on Linux and all other Unix-like systems I know of, all users are allowed to list running processes and their command lines.

> Protecting yourself from a rogue process that can monitor `ps` is also already a lost battle.

ps is not a privileged command on most systems. POSIX says "On some implementations, especially multi-level secure systems, ps may be severely restricted and produce information only about child processes owned by the user."; "severely restricted" implies that this is not a common behavior.

furthermore, the article explains clearly how to hide secret arguments from ps. that's the main point of the article.

comment 5y ago · link · parent

Brother did not invent ink tanks. According to https://en.wikipedia.org/wiki/Supertank_printers, Epson first introduced supertank printers to the US market, but continuous ink systems with (I assume) external tanks are at least 15 years old: https://en.wikipedia.org/w/index.php?title=Continuous_ink_sy.... As far as I can tell, your linked article doesn't even claim that Brother invented ink tanks, merely that Brother sells them and they are good.

comment 5y ago · link · parent

more specifically the problem with type is it's not clear whether "An error occurred" includes the case where the command is not found. one could reasonably argue that printing "command not found" is a successful run. additionally, it's only present in the XSI extension. for these reasons, command -v is usually preferred for better POSIX compatibility.

comment 5y ago · link · parent

as I comment in basically every one of these shell articles, while Unix shell does kinda suck, the main problem is that the bad examples far, far outnumber the good ones, and so everybody programs in an overly complicated manner.

  SCRIPT_DIR="${0%/*}"
works in practically all shells, as long as the script is actually invoked by path (if you do curl script | bash, you're SOL right off the bat).

the same applies with "combination of grep, awk and cut". awk contains almost all the functionality of grep, sed, and cut, so any pipeline of awk plus one of the others is almost always unnecessarily complicated. it would be like complaining "in python, string handling is so hard. look, you have to do import re; for x in re.sub(...).match(5).split(' ')[3:-5]: lst.append(x)". of course if you make it overly complicated then it will be overly complicated.

there are also too many footguns. spaces and newlines are trivial to handle in 95% of scripts, as long as you quote every expansion. as long as you never ever write cmd $file and always write cmd "$file", that solves virtually all whitespace problems. quotation marks in filenames are never interpreted in a special manner in Bourne-like shell unless you use eval, which has the same pitfalls as any other interpreted language (see python above).

1
567
34