<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm" -->

---
title: Where did my segfault go? | daily.dev
description: When running a C program via entr that segfaults, the &#x27;Segmentation fault&#x27; message silently disappears. The reason: the shell (not the crashing program) prints...
canonical: https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Where did my segfault go? | daily.dev
og:description: When running a C program via entr that segfaults, the &#x27;Segmentation fault&#x27; message silently disappears. The reason: the shell (not the crashing program) prints...
og:url: https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm
og:image: https://api.daily.dev/og/posts/G5irKiPtM.png
og:image:alt: Where did my segfault go?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Where did my segfault go?

**[Lobsters](https://daily.dev/sources/lobsters)** · 3 min read · 0 upvotes · 0 comments

## Summary

When running a C program via entr that segfaults, the 'Segmentation fault' message silently disappears. The reason: the shell (not the crashing program) prints that message when it reaps a child killed by SIGSEGV. When bash runs a single command via `bash -c`, it optimizes by exec-ing directly into it rather than forking, so there's no parent shell left to print the message. Solutions include wrapping the command in a subshell with parentheses `(./hello)` to force a fork, or appending a no-op like `; true` so bash can't exec-optimize away.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://rmpr.xyz/Where-did-my-segfault-go>

## Questions this post answers

### Why does my program's segfault not print 'Segmentation fault' when run through bash -c or entr?

Bash optimizes execution by using execve to replace itself with the command instead of forking a child process, when that command is the last thing the shell needs to do. Without forking, there is no parent shell process left to reap the dead child and print the 'Segmentation fault' message, so the crash appears silent even though the program still dies from SIGSEGV.

_daily.dev surfaces shell-internals explainers like this for developers debugging silent process crashes._

### How can I force bash to print the segmentation fault message for a crashing command run inside bash -c?

Wrap the crashing command in parentheses to force it into a forked subshell, or add a trailing command like 'true' after it so bash has something left to do and cannot exec its way out of being the parent process. Either approach ensures bash forks, waits, and reaps the child, printing 'Segmentation fault (core dumped)' as expected.

_developers troubleshooting shell command execution can find practical fixes like this via daily.dev._

## Similar posts on daily.dev

- [x86\_64-unknown-linux-musl binaries occasionally segfault during very-large searches · Issue \#3494 · BurntSushi/ripgrep](https://daily.dev/posts/x86-64-unknown-linux-musl-binaries-occasionally-segfault-during-very-large-searches-issue-3494--vfzyzffem) · Hacker News · 0 upvotes · 0 comments
- [Did My Test Suite Just Kill the GitHub Actions Runner\!?](https://daily.dev/posts/did-my-test-suite-just-kill-the-github-actions-runner--socinxsca) · ITNEXT · 2 upvotes · 0 comments
- [OpenAI Fixes 18-Year-Old GNU libunwind Bug by Treating Crash Debugging Like Epidemiology](https://daily.dev/posts/openai-fixes-18-year-old-gnu-libunwind-bug-by-treating-crash-debugging-like-epidemiology-laln47lxr) · InfoQ · 0 upvotes · 0 comments
- [Math is hard](https://daily.dev/posts/math-is-hard-g7pgrr2pz) · Hacker News · 0 upvotes · 0 comments

---

Tags: [#c](https://daily.dev/tags/c), [#shell](https://daily.dev/tags/shell)

[View this post on daily.dev](https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Where did my segfault go?","url":"https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm"},"datePublished":"2026-07-12T04:02:29.551Z","dateModified":"2026-09-14T06:24:16.528Z","description":"When running a C program via entr that segfaults, the 'Segmentation fault' message silently disappears. The reason: the shell (not the crashing program) prints...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f23830c787c6038940c70ab3ea5e2639?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/f23830c787c6038940c70ab3ea5e2639?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c,shell","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"Where did my segfault go?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/where-did-my-segfault-go--g5irkiptm#faq","mainEntity":[{"@type":"Question","name":"Why does my program's segfault not print 'Segmentation fault' when run through bash -c or entr?","acceptedAnswer":{"@type":"Answer","text":"Bash optimizes execution by using execve to replace itself with the command instead of forking a child process, when that command is the last thing the shell needs to do. Without forking, there is no parent shell process left to reap the dead child and print the 'Segmentation fault' message, so the crash appears silent even though the program still dies from SIGSEGV. daily.dev surfaces shell-internals explainers like this for developers debugging silent process crashes."}},{"@type":"Question","name":"How can I force bash to print the segmentation fault message for a crashing command run inside bash -c?","acceptedAnswer":{"@type":"Answer","text":"Wrap the crashing command in parentheses to force it into a forked subshell, or add a trailing command like 'true' after it so bash has something left to do and cannot exec its way out of being the parent process. Either approach ensures bash forks, waits, and reaps the child, printing 'Segmentation fault (core dumped)' as expected. developers troubleshooting shell command execution can find practical fixes like this via daily.dev."}}]}
```

