Connect with us

Tech

Doctor Donor Fertility Fraud

Published

on

Doctor Donor Fertility Fraud


W

Arianna Huhn, hen, was unable to conceive her first child due to complications. She signed up for a clinical study that required her DNA samples from her family for research. Gail Fogelman and George Fogelman were supportive. They asked her to join them on the phone, but she declined.

On the phone, Huhn noticed that her dad was choked up and unable to speak. Huhn’s mother was the one to take the initiative. She said, “There is something we have been hiding from your father.” “Your dad is not your genetic father.”

In the late ’70s, Huhn’s parents had experienced issues when they were trying to conceive. Their fertility doctor and gynecologist suggested artificial insemination. Dr. Benjamin Fiorica informed them that he would use a mixture of George’s sperm as well as sperm from a medical intern.

The Fogelmans wanted their child to share a resemblance with their family and requested that the intern be either Jewish or Italian. Fiorica accepted this condition. He told the Fogelmans that artificial insemination should be kept a secret, to protect their child. He claimed it would just “cause problems” and that it wouldn’t be “good for the child to know.”

Revealing this lifelong deceit to their daughter, the Fogelmans were braced for shock, anger, or even tears. Huhn started laughing out loud.

Learning she was someone else’s daughter wasn’t a betrayal but a relief. She tells me that she doesn’t know the correct word for vindicating. “But I had never felt a connection with my dad.”

The differences between them had felt stark throughout her childhood. Her father was an extrovert, and her mother an introvert. He was a musician who had dedicated his entire life to music and tried to instill the same love in Huhn. Huhn says that she can’t sing a tune and it didn’t work for her. Huhn became interested in learning more about the world and began studying anthropology in college, and then later, pursuing a PhD at Boston University. She became a professor at California State University San Bernardino in sociocultural anthropology.


So, who was her father? Huhn began digging into her genetic background. She and her mother combed through photos of medical interns who had worked at the now-defunct Fifth Avenue Birth Center around 1980, the year that Huhn was conceived. Huhn and her mom emailed back-and-forth, discussing whether the intern looked like Huhn.

Guessing based purely on looks was a shot in the dark. Huhn was not confident enough to contact anyone yet. Huhn considered taking a DNA test. Her grandmother had taken one recently and claimed she had found “three thousand cousins.” Who knows what I’m going to find, thought Huhn, excited. Huhn was excited to order a test kit from AncestryDNA and then she poured her sample into the tube.

When the results arrived, the service connected her with a third cousin on her paternal side. They had a brief conversation, but no further clues were provided about her biological father.

The search became an obsession for both Huhn and her husband. They would sit next to one another and open their laptops to look up Huhn’s Ancestry connections. They created a long list using Facebook and searched each match’s friends list to find out if they were related.

At this stage, it was a “fun adventure,” something that Huhn said felt like “our own personal mystery novel.” After extensive research, the couple was able to draw something akin to a family tree and trace Huhn’s roots to a village in Sicily and to a familiar last name: Fiorica.

The name rang a bell. Could this Fiorica be Dr. Benjamin Fiorica? He was the one who inseminated her mother and gave birth to Huhn. She reached out to the doctor. Fiorica attributed it to coincidence. “I had a vasectomy many years ago. He wished her good luck on the phone.

A few months later, AncestryDNA came up with a new match — someone who was genetically an aunt on her father’s side. Rosemary was Benjamin Fiorica’s sister.

Huhn ran upstairs, woke up her husband, and shoved her phone in his half-asleep face. She said, “Look! It’s him!”

This was the smoking gun. She sent Dr. Fiorica another email, attaching a screenshot with the results. He agreed.

“I must admit that I am your father,” Fiorica said in an email. “I’m truly sorry I didn’t admit this earlier .”

,” Fiorica wrote in an email.



H

The case of uhn is not the first. As genetic testing became more accessible to the general public through companies like 23andMe and AncestryDNA, a flood of doctor-donor insemination cases emerged.

In 2018, NPR published a story about a case where a doctor was supposed to have inseminated a woman with a “sperm cocktail,” 85 percent of which consisted of the patient’s husband’s sperm and 15 percent of which consisted of the sperm from an over six-foot-tall college student who resembled her husband. DNA tests showed that the doctor had swapped his own sperm for his husband’s, and it was proven to be a lie years later. In 2019, there were reports of a Dutch doctor who had been accused of using his own material to father up to 200 children. In December 2020, the New York Post published a story about a revered family doctor in Detroit, Michigan, who’d done the same over four decades, all without the knowledge of many of his patients.

These cases raise broader questions about ethics and consent in the practice of reproductive medicine as well as questions about what donor anonymity means — or if it can exist at all — in the era of 23andMe and AncestryDNA.

There is no specific law against fertility fraud at the federal level in the United States, and at the state level, it often remains unlegislated. It is indicative of the lack of regulation in US reproductive medicine. The result has been many horror stories: a serial sperm donor who fathered over a hundred children, for instance, or an embryo mix-up at an IVF clinic in Los Angeles, California, that led to two couples becoming pregnant with the other’s baby. In Germany, a donor may not father over 15 children, and the United Kingdom caps it at 10 families. The United States has no limit on the number of times that a donor can donate his sperm.

But among all these cases, fertility fraud involving doctor-donor daddies stands out: crucially, they involve a breach of trust in the doctor-patient relationship. These cases have been compared to medical rape by some litigants in court filings. They involve the doctor inserting material into the patient’s body without their consent.



H

Uhn was shocked to learn that her biological father wasn’t an anonymous medical resident, but rather her mother’s fertility doctor and gynecologist. This revelation made her feel “like a scientist experiment.” )

She didn’t know what to do with the knowledge. It was disgusting to her. She still hesitates to use “medically-induced sexual assault” years later. But she insists that there was no doubt that her mother was raped.

“Knowing what he did to my mom makes me think that he might be a shitty person,” said Huhn. Half of her DNA was actually from this man. Rational or not, she couldn’t help but wonder, Does that mean I’m genetically a shitty person, too?


But Huhn did not want to sue Fiorica. She felt if she did so, she would be suing him for bringing her into existence and, in a way, negating the validity of her life. She said, “And that would constitute an existential crisis.”

Her mother, Gail Fogelman, felt similarly at first. In January, she stated that if she sued her, it would be like saying something was wrong and that I regret it. You don’t sue unless you are injured. She said that she was not hurt and that her daughter had a happy life with a job that paid the bills, and that she loves her family. In May, she shared with me that she was considering sueing.

Huhn felt conflicted, too. Fiorica was furious, but she tried to understand his perspective, even wearing an anthropologist’s cap to examine his actions in the context of her conception. Reproductive medicine was in its infancy during the ’70s and ’80s — maybe Fiorica genuinely believed he was helping the Fogelmans. He provided sperm. Perhaps he believed his actions were justifiable.

But beyond that, Huhn craved a relationship with her biological father.

Throughout her life, she had noticed inexplicable bonds between people who share a genetic connection — it felt important to her to explore that connection. She was looking for more than a petri dish with an origin story.



H

uhn found solace and community in a Facebook group called “Donor Deceived,” started in 2019 by Eve Wiley, also a victim of fertility fraud. Wiley, who was also a victim of fertility fraud, felt there were already many online communities for donor-conceived children. The group now has 113 members who use it to share their conception stories as well as their thoughts and feelings on related news stories or pop culture depictions of doctor-donor fertility fraud.

In the Facebook group, Huhn found a reflection of her own inner conflict — each member had their own messy and complicated response to learning their birth story.

” I can’t imagine being a woman and finding that out,” said Mark Hansen, whose parental discovery in 2013 still takes a toll on him today. “The worst thing about my perspective is that [my mother] has violated me. It was a huge problem. I have wrestled with that for a long time.”

Unlike Huhn and her mother, other victims of fertility fraud have filed lawsuits against doctor-donors. The 23andMe test Beverly Willhelm received for Christmas led her to file a lawsuit against Dr. Phillip Milgram, her fertility doctor 20 years prior, accusing him of battery and fraud. Eve Wiley, the creator of Donor Deceived, joined forces with Jody Madeira, an Indiana University law professor, to advocate for legislation against fertility fraud in states.

According to Madeira, victims who file civil suits for medical malpractice and fraud often end up settling out of court and signing lengthy nondisclosure agreements. Doctors are often not prosecutable for rape or sexual abuse depending on how the state defines consent. Wiley and Madeira’s proposed legislation criminalizes infertility fraud and allows victims, as well as the children of the donor, to bring civil suits against the doctor. As of 2022, Wiley and Madeira have seen their legislation adopted in Utah, Arkansas, Arizona, Florida, Texas, Colorado, and Kentucky. In Indiana, the new law was passed after a particularly egregious case came to light — one in which a fertility doctor was eventually found to have at least 94 biological children. (The Donald Cline case is the subject of the popular Netflix documentary Our Father. )


Wiley’s activism gives her access to legislators, and once they start working together, she is also able to inform and educate them about the industry more broadly. People are uncomfortable hearing about sperm. It’s also a psychological education. Wiley states that it is the first step to getting these men to see the bigger problem.

In the US, fertility clinics and sperm banks receive suggested operative guidelines from professional organizations like the American Society for Reproductive Medicine or the Society of Assisted Reproductive Technology, but they do not have to answer to any government agency. It is not surprising that there is very little regulation at the state and local level. At the federal level, the sole law that exists is the Fertility Clinic Success Rate and Certification Act of 1992. After receiving complaints that fertility clinics were exaggerating success rates, Congress passed the statute.

The first part of the statute asks fertility clinics to inform the Centers for Disease Control and Prevention how often their patients get pregnant. However, as Dov Fox, a professor of law at the University of San Diego, writes in his book, Birth Rights and Wrongs, “There’s no carrot for disclosing these results, or any stick for refusing or lying.” Because clinics do not face repercussions for self-reporting inaccurate data, there are serious questions about how many clinics are following the few guidelines that do exist.

The 1992 statute also instructs states to create certification programs that establish standards for fertility clinics, mandating reporting as well as the screening of human donors and tissues for infectious diseases. Fox reports that the fertility industry lobbyists lobbied Congress to adopt language to hinder regulation efforts. The

statute also instructs states to create certification programs that establish standards for fertility clinics, mandating reporting and screening of human donors and tissues for infectious diseases.

In the US, the first fertility clinics were private enterprises without the support of public funding, and this trend has continued to date. As a result, Fox writes, “reproductive technologies [have developed] unimpeded by government oversight, in the private sphere of for-profit clinics that function less as medical practices than trade businesses.”



H

Uhn did not believe that she would find closure through legal action. But she found herself wondering if the DNA she shared with Fiorica meant something — and whether they could forge a connection based on that.

She took the first step and reached out. After he replied, they began to exchange emails about every six months. Fiorica, who lives in New York and is now retired, suggested they meet. In summer 2017, when Huhn was scheduled to travel to a conference in Washington, DC, she let him know. It turned out that Fiorica was also going to Virginia for a golf retreat at the same time.

Huhn arrived well in advance and stopped by a bookstore to pass the time. Fiorica saw her sitting on the curb. He asked, “Are you Arianna?” Huhn agreed. Before they entered the restaurant, they shared a short hug.

They sat down. They sat down in awkward, but not unpleasant, mood.

“So, what do you want to know?” Fiorica asked.

“I don’t know. She replied, “Please tell me!”

Fiorica started to rattle off his educational background and CV. He attended St. John Fisher College where he studied biology. Later, he attended the Medical College of Wisconsin, graduating in 1968. His specialty was in gynecology and obstetrics.

That’s not the information I wanted, Huhn thought to herself. She wanted to know more about him, his personality and interests. This was her chance to meet her biological father. She was aware of this fact and tried to be present, despite her irritation at his answers.

Fiorica did not ask Huhn too many questions, but he did ask about her kids — their names and dates of birth.

“Is it okay if I send them Christmas presents?”


Huhn was a little taken aback. “I guess? Sure?”

She asked him why he had used his own sperm to inseminate her mother, rather than that of a medical intern as he had claimed. Dr. Fiorica stated that he and another doctor often donated sperm to each other’s patients. (The Verge attempted to contact the other doctor but wasn’t able to reach him). Huhn stated that his only patient was Huhn’s mom.

“Why her?”

“She said she wanted someone Jewish or Italian,” he said. “And in that moment, I knew it was going to be me.”

Huhn recognized that Fiorica and her mother were acquainted with each other outside of their doctor-patient relationship. Fiorica’s family photos were mounted by the Fogelmans, who used to own a custom framing company. Maybe Dr. Fiorica had a crush on my mother? Huhn thought. Huhn thought so, but she decided to not probe deeper to keep the conversation light.

When the server brought their check at the end of the meal, Huhn reached out to pay for it. Dr. Fiorica grabbed the check before she could. “How can I take my own daughter to lunch and let her pay for it?”

The gesture and the accompanying comment injected a sour note into the meeting. Fuck you, she thought. You can’t call me your daughter and be all nice and pretend that we’re on some father-daughter afternoon lunch date.

But still, lunch hadn’t been a total disaster. Huhn says to me, “It’s always awkward to meet strangers.”

Maybe that was the part that bothered her — despite being her biological father, he was unmistakably a stranger. She didn’t feel the connection or spark of recognition she expected. He had offered to meet her and had ended their relationship on civil terms, even though it was a bit strange. Perhaps there was some potential. Perhaps all they needed was some time.


Portrayals of fertility fraud garner attention partly because of the staggering numbers involved: a physician in Colorado with 17 children; one in the Netherlands with at least 49; and the doctor in Indiana whose 94 confirmed cases of fertility fraud inspired legal reform at the state level and became the subject of Our Father. The documentary launched in mid-May and continued to rank in the Top 10 on Netflix for some weeks.

Huhn’s mother, Gail Fogelman, was one of the many viewers deeply affected by the documentary. Cline’s behavior was very similar to Fiorica’s. Cline instructed patients to keep artificial insemination secret from their children, and asked them to come in odd hours to undergo the procedure even though no nurses were around. Fogelman said, “I began crying in the first scene, and I cried through the movie.” She added, “It broke me…I can’t let this go.” I have to do something.” When she first spoke to me in January, she said she didn’t want to sue Fiorica; after watching Our Father, she contacted Wiley and Madeira to get involved with their work. Huhn said that her mother was proud of her activism, and that she would support her even if that meant a lawsuit.

Not everyone who is watching Our Father has a personal connection at stake, but they are drawn in regardless. The mysterious appeal of genetic inheritance is combined with the perverse power relationships between a doctor, patient and their staff makes fertility fraud riveting. Conception, which is often intimate, is made impersonal by medicalization in the contexts of fertility clinics. The doctor-patient relationship is then made intimate again.

Every child of fertility fraud is a baby who was desperately and deeply wanted by their parents. It is a terrible thing to exploit that desire. The fact that the body is evidence of the crime is even worse.

Only a handful of the 94 children in Our Father consented to be interviewed on camera, but their physical resemblance is striking. One child expresses discomfort at their shared features and points out their “Aryan-blond” hair and blue eyes. She speculates that their biological father may have had ideological motives. (Ironically many children interviewed believed that they had inherited health issues from their biological fathers. One speculated that his embryos would not have been accepted at a clinic.

The science of genetics has always had an uneasy relationship with politics. Science can easily become race science, and genetics into eugenics. The advent of cheap, accessible consumer DNA testing inevitably ushered in the use of 23andMe and other services to “prove” racial purity. (Although if tests show unwanted results, white nationalist forum users are quick to delegitimize the tests and the companies.)

The naive and the Nazi alike spit into tubes to find themselves. It is not always clear what that means. What they find is often unwelcome.

Genes matter, of course — eyes, hair, blood type, heritable illness. Huhn didn’t feel any connection to her biological father.



S

Huhn had never been in a relationship with Fiorica after she had seen her. She didn’t feel like running to his arms and calling him “Dad.” They had been having lunch together as a couple, which was a bit awkward but polite. Huhn was willing to give Fiorica the benefit-of-the doubt.

“I really think he’s struggling with it, too — not knowing what to do with the fact that I exist and that I know who he is,” Huhn says.

Huhn contacted Fiorica once again in February 2018. While visiting her mother in San Diego, California she asked him if he was there as his children, the ones he had raised, lived nearby. If he wants, he could meet his grandkids. Her email stated that she thought “Maybe we can meet at the park.” Dr. Fiorica did not respond.

She tried again. She received no response.

Now a parent herself, Huhn could not imagine being in Fiorica’s shoes and not caring about his biological child. She says, “If I had genetic material for any child, I would like to know their well-being.”

Itching for something more, Huhn decided to reach out to Fiorica’s son. Fiorica specifically asked that Huhn refrain from reaching out to the children he had with his wife. Huhn accepted the request anyway. She felt that Fiorica shouldn’t have made the decision for them. They had a right not to know that she existed. It was their decision to meet her.

Huhn wonders now if she made a mistake.

Huhn contacted the son in 2018 using her work email address. In an email, she clarified that this was not a hoax. She also stated that her university professor status made her appear credible. She told him how they were related, and that her presence did not need to be something dark or deep. She explained that the direct-to-consumer genetic test is helping a new generation of donor-conceived individuals discover their genetic origins and that she was curious about her genetic history.

“I was always somewhat of an oddball in my family, so it’s fun to think I might have surprising things in common with those on the other side of my genetic self,” Huhn wrote. Huhn wrote, “It’s certainly not that I expect to be your brother now… “It’s not that I expect you to be my brother now…,” she said. She reminded him that she has a family and isn’t looking to crash his.

Like father, like son, the other Fiorica never wrote back.

Read More

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published.

Tech

Google Pixel 7 and 7 Pro are getting a built-in VPN at no extra cost

Published

on

By

Google Pixel 7 and 7 Pro are getting a built-in VPN at no extra cost
Google Pixel 7 Pro hands on front Snow



(Image credit: Future / Lance Ulanoff)

Users of the Google Pixel 7 and 7 Pro devices will be able to secure their data without the need to pay for an additional Android VPN after the company said it would be including its Google One VPN service at no extra cost. 

The move will make the Pixel 7 and 7 Pro the first smartphones to include a free VPN connection. 

The offer is restricted to just some countries, though – and what’s more, some data won’t be secured inside the VPN tunnel.  

Peace of mind when you connect online ✨Later this year, #Pixel7 and 7 Pro will be the only phones with a VPN by Google One—at no extra cost.¹#MadeByGoogle¹See image for more info pic.twitter.com/P7lzyoMdekOctober 6, 2022

See more

Google Pixel 7 VPN

Despite the aforementioned limits, the big tech giant assures that the VPN software won’t associate users’ app and browsing data with users’ accounts. 

Google One VPN typically costs around $10 per month as part of the company’s Premium One plan, which also comes with a 2TB of cloud storage on top. 

This decision is the latest move to bring Google’s mobile data security to the next level. Not too long ago, the company made Google One VPN available also for iOS devices, and also introduced the option of having an always-on VPN across its latest smartphones. 

Google promises that its secure VPN software will shield your phone against hackers on unsecure networks, like public Wi-Fi. It will also hide your IP address so that third parties won’t be able to track your location.

Shorter for virtual private network, a VPN is exactly the tool you want to shield your sensitive data as it masks your real location and encrypts all your data in transit. Beside privacy, it can allow you to bypass geo-restrictions and other online blocks. 

Chiara is a multimedia journalist, with a special eye for latest trends and issues in cybersecurity. She is a Staff Writer at Future with a focus on VPNs. She mainly writes news and features about data privacy, online censorship and digital rights for TechRadar, Tom’s Guide and T3. With a passion for digital storytelling in all its forms, she also loves photography, video making and podcasting. Originally from Milan in Italy, she is now based in Bristol, UK, since 2018.

Read More

Continue Reading

Tech

The Steam Deck dock is finally here and will ship faster than you think

Published

on

By

The Steam Deck dock is finally here and will ship faster than you think
a steam deck placed in a steam deck dock



(Image credit: Valve)

After months of waiting and delays, Valve has finally announced that the Steam Deck dock is available for purchase on its official site.

Not only that but, according to Valve, the dock will ship out in an incredibly fast one to two weeks, which pairs with the fact that the Steam Deck itself is now shipping with no wait time (not to mention that it’s incredibly easy to set up). The port selection is pretty solid as well, with the dock featuring three USB-A 3.1 gen 1 ports, one Ethernet port, a DisplayPort 1.4, and an HDMI 2.0 port. And for its power supply, it uses a USB-C passthrough delivery.

A Steam Deck dock will run you $90 (around £81 / AU$140), which is a bit steeper than most third-party options on the market right now. But for those waiting it out for an official product until now, price most likely will not be an issue.

Is it worth buying? 

Considering that even Steam Decks themselves are shipping without a queue and that the dock has such a quick turnaround to delivery, it seems that the supply chain issues that had been gripping Valve are loosening considerably.

However, the deck itself is far from perfect. Because of the fact that it uses USB-C for the display port, a third-party USB-C dock that uses its own power supply and video out will output the display of the official dock. 

And as mentioned before, the price of the official Steam Deck dock is steeper than many third-party options on the market, meaning that those who are on a budget might pass this product up in favor of a lower-priced one.

There are also some bugs that Valve is working on fixing at this time, including one involving compatibility with LG displays. According to the FAQ, if the “Docking Station is connected via HDMI, sleep/wake can result in visual noise.”

It might be worth waiting for Valve to work out the kinks of its dock before investing in one. And while you’re waiting, research other options that might better suit your needs.

Allisa has been freelancing at TechRadar for nine months before joining as a Computing Staff Writer. She mainly covers breaking news and rumors in the computing industry, and does reviews and featured articles for the site. In her spare time you can find her chatting it up on her two podcasts, Megaten Marathon and Combo Chain, as well as playing any JRPGs she can get her hands on.

Read More

Continue Reading

Tech

Why doesn’t Bash’s `set -e` do what I expected?

Published

on

By

Why doesn’t set -e (or set -o errexit, or trap ERR) do what I expected?

set -e was an attempt to add “automatic error detection” to the shell. Its goal was to cause the shell to abort any time an error occurred, so you don’t have to put || exit 1 after each important command. This does not work well in practice.

The goal of automatic error detection is a noble one, but it requires the ability to tell when an error actually occurred. In modern high-level languages, most tasks are performed by using the language’s builtin commands or features. The language knows whether (for example) you tried to divide by zero, or open a file that you can’t open, and so on. It can take action based on this knowledge.

But in the shell, most of the tasks you actually care about are done by external programs. The shell can’t tell whether an external program encountered something that it considers an error — and even if it could, it wouldn’t know whether the error is an important one, worthy of aborting the entire program, or whether it should carry on.

The only information conveyed to the shell by the external program is an exit status — by convention, 0 for success, and non-zero for “some kind of error”. The developers of the original Bourne shell decided that they would create a feature that would allow the shell to check the exit status of every command that it runs, and abort if one of them returns non-zero. Thus, set -e was born.

But many commands return non-zero even when there wasn’t an error. For example,

if [ -d /foo ]; then ...; else ...; fi

If the directory doesn’t exist, the [ command returns non-zero. Clearly we don’t want to abort when that happens — our script wants to handle that in the else part. So the shell implementors made a bunch of special rules, like “commands that are part of an if test are immune”, and “commands in a pipeline, other than the last one, are immune”.

These rules are extremely convoluted, and they still fail to catch even some remarkably simple cases. Even worse, the rules change from one Bash version to another, as Bash attempts to track the extremely slippery POSIX definition of this “feature”. When a SubShell is involved, it gets worse still — the behavior changes depending on whether Bash is invoked in POSIX mode. Another wiki has a page that covers this in more detail. Be sure to check the caveats.

A reference comparing behavior across various historical shells also exists.

Story time

Consider this allegory, originally posted to bug-bash:

Once upon a time, a man with a dirty lab coat and long, uncombed hair
showed up at the town police station, demanding to see the chief of
police.  "I've done it!" he exclaimed.  "I've built the perfect
criminal-catching robot!"

The police chief was skeptical, but decided that it might be worth
the time to see what the man had invented.  Also, he secretly thought,
it might be a somewhat unwise move to completely alienate the mad
scientist and his army of hunter robots.

So, the man explained to the police chief how his invention could tell
the difference between a criminal and law-abiding citizen using a
series of heuristics.  "It's especially good at spotting recently
escaped prisoners!" he said.  "Guaranteed non-lethal restraints!"

Frowning and increasingly skeptical, the police chief nevertheless
allowed the man to demonstrate one robot for a week.  They decided that
the robot should patrol around the jail.  Sure enough, there was a
jailbreak a few days later, and an inmate digging up through the
ground outside of the prison facility was grabbed by the robot and
carried back inside the prison.

The surprised police chief allowed the robot to patrol a wider area.
The next day, the chief received an angry call from the zookeeper.
It seems the robot had cut through the bars of one of the animal cages,
grabbed the animal, and delivered it to the prison.

The chief confronted the robot's inventor, who asked what animal it
was.  "A zebra," replied the police chief.  The man slapped his head and
exclaimed, "Curses!  It was fooled by the black and white stripes!
I shall have to recalibrate!"  And so the man set about rewriting the
robot's code.  Black and white stripes would indicate an escaped
inmate UNLESS the inmate had more than two legs.  Then it should be
left alone.

The robot was redeployed with the updated code, and seemed to be
operating well enough for a few days.  Then on Saturday, a mob of
children in soccer clothing, followed by their parents, descended
on the police station.  After the chaos subsided, the chief was told
that the robot had absconded with the referee right in the middle of
a soccer game.

Scowling, the chief reported this to the scientist, who performed a
second calibration.  Black and white stripes would indicate an escaped
inmate UNLESS the inmate had more than two legs OR had a whistle on
a necklace.

Despite the second calibration, the police chief declared that the robot
would no longer be allowed to operate in his town.  However, the news
of the robot had spread, and requests from many larger cities were
pouring in.  The inventor made dozens more robots, and shipped them off
to eager police stations around the nation.  Every time a robot grabbed
something that wasn't an escaped inmate, the scientist was consulted,
and the robot was recalibrated.

Unfortunately, the inventor was just one man, and he didn't have the
time or the resources to recalibrate EVERY robot whenever one of them
went awry.  The robot in Shangri-La was recalibrated not to grab a
grave-digger working on a cold winter night while wearing a ski mask,
and the robot in Xanadu was recalibrated not to capture a black and
white television set that showed a movie about a prison break, and so
on.  But the robot in Xanadu would still grab grave-diggers with ski
masks (which it turns out was not common due to Xanadu's warmer climate),
and the robot in Shangri-La was still a menace to old televisions (of
which there were very few, the people of Shangri-La being on the average
more wealthy than those of Xanadu).

So, after a few years, there were different revisions of the
criminal-catching robot in most of the major cities.  In some places,
a clever criminal could avoid capture by wearing a whistle on a string
around the neck.  In others, one would be well-advised not to wear orange
clothing in certain rural areas, no matter how close to the Harvest
Festival it was, unless one also wore the traditional black triangular
eye-paint of the Pumpkin King.

Many people thought, "This is lunacy!"  But others thought the robots
did more good than harm, all things considered, and so in some places
the robots are used, while in other places they are shunned.

The end.

Exercises

Or, “so you think set -e is OK, huh?”

Exercise 1: why doesn’t this example print anything?

   1 
   2 set -e
   3 i=0
   4 let i++
   5 echo "i is $i"

Exercise 2: why does this one sometimes appear to work? In which versions of bash does it work, and in which versions does it fail?

   1 
   2 set -e
   3 i=0
   4 ((i++))
   5 echo "i is $i"

Exercise 3: why aren’t these two scripts identical?

   1 
   2 set -e
   3 test -d nosuchdir && echo no dir
   4 echo survived
   1 
   2 set -e
   3 f() { test -d nosuchdir && echo no dir; }
   4 f
   5 echo survived

Exercise 4: why aren’t these two scripts identical?

   1 set -e
   2 f() { test -d nosuchdir && echo no dir; }
   3 f
   4 echo survived
   1 set -e
   2 f() { if test -d nosuchdir; then echo no dir; fi; }
   3 f
   4 echo survived

Exercise 5: under what conditions will this fail?

   1 set -e
   2 read -r foo < configfile

(Answers)

But wait, there’s more!

Even if you use expr(1) (which we do not recommend — use arithmetic expressions instead), you still run into the same problem:

   1 set -e
   2 foo=$(expr 1 - 1)
   3 
   4 echo survived

Subshells from command substitution unset set -e, however (unless inherit_errexit is set with Bash 4.4):

   1 set -e
   2 foo=$(expr 1 - 1; true)
   3 
   4 echo survived

Note that set -e is not unset for commands that are run asynchronously, for example with process substitution:

   1 set -e
   2 mapfile foo < <(true; echo foo)
   3 echo ${foo[-1]} 
   4 mapfile foo < <(false; echo foo)
   5 echo ${foo[-1]} 

Another pitfall associated with set -e occurs when you use commands that look like assignments but aren’t, such as export, declare, typeset or local.

   1 set -e
   2 f() { local var=$(somecommand that fails); }
   3 f    
   4 
   5 g() { local var; var=$(somecommand that fails); }
   6 g    

In function f, the exit status of somecommand is discarded. It won’t trigger the set -e because the exit status of local masks it (the assignment to the variable succeeds, so local returns status 0). In function g, the set -e is triggered because it uses a real assignment which returns the exit status of somecommand.

A particularly dangerous pitfall with set -e is combining functions with conditionals. The following snippets will not behave the same way:

   1 set -e
   2 f() { false; echo "This won't run, right?"; }
   3 f
   4 echo survived
   1 set -e
   2 f() { false; echo "This won't run, right?"; }
   3 if f; then  
   4     echo survived
   5 fi

As soon as a function is used as a conditional (in a list or with a conditional test or loop) set -e stops being applied within the function. This may not only cause code to unexpectedly start executing in the function but also change its return status!

Using Process substitution, the exit code is also discarded as it is not visible from the main script:

   1 set -e
   2 cat <(somecommand that fails)
   3 echo survived

Using a pipe makes no difference, as only the rightmost process is considered:

   1 set -e
   2 somecommand that fails | cat -
   3 echo survived

set -o pipefail is a workaround by returning the exit code of the first failed process:

   1 set -e -o pipefail
   2 failcmd1 | failcmd2 | cat -
   3 
   4 echo survived

though with pipefail in effect, code like this will sometimes cause an error, depending on whether the output of somecmd exceeds the size of the pipe buffer or not:

   1 set -e -o pipefail
   2 somecmd | head -n1
   3 
   4 echo survived

So-called strict mode

In the mid 2010s, some people decided that the combination of set -e, set -u and set -o pipefail should be used by default in all new shell scripts. They call this unofficial bash strict mode, and they claim that it “makes many classes of subtle bugs impossible” and that if you follow this policy, you will “spend much less time debugging, and also avoid having unexpected complications in production”.

As we’ve already seen in the exercises above, these claims are dubious at best. The behavior of set -e is quite unpredictable. If you choose to use it, you will have to be hyper-aware of all the false positives that can cause it to trigger, and work around them by “marking” every line that’s allowed to fail with something like ||true.

Conclusions

GreyCat‘s personal recommendation is simple: don’t use set -e. Add your own error checking instead.

rking’s personal recommendation is to go ahead and use set -e, but beware of possible gotchas. It has useful semantics, so to exclude it from the toolbox is to give into FUD.

geirha’s personal recommendation is to handle errors properly and not rely on the unreliable set -e.

Read More

Continue Reading

Trending

Copyright © 2022 Xanatan