From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,892f841b317b302e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!sn-xit-04!sn-xit-12!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Benjamin Ketcham Newsgroups: comp.lang.ada Subject: Re: Format string bugs & race conditions Date: Sun, 17 Oct 2004 05:28:58 -0000 Organization: Ye 'Ol Disorganized NNTPCache groupie Message-ID: <1097990937.246146@yasure> References: <1c2f5137.0410160128.7ef88436@posting.google.com> User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (Linux/2.4.20-29.8.progeny.8 (i686)) Cache-Post-Path: yasure!unknown@cascadia.drizzle.com X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Complaints-To: abuse@supernews.com Xref: g2news1.google.com comp.lang.ada:5347 Date: 2004-10-17T05:28:58+00:00 List-Id: Jeffrey Carter wrote: > Hans Van den Eynden wrote: > >> In C/C++ there is a major problem with "Format string bugs" & "race >> conditions". Can this appear in ada??? and if soo how?? > > How can you have race conditions in a sequential language? Easy: have more than one process/thread accessing the same resources. Same as with a "non-sequential language". Note that while the language may have no concept of concurrency, as with C, it can still be used to write an OS or thread library which does implement (simulated) concurrency. And once you have that, it's a quick slip down the slope to: /* If lockfile already exists, wait until it goes away. */ while((p = fopen("lockfile", "r"))) { fclose(p); sleep(1); } /* (race) */ p = fopen("lockfile", "w"); /* Access the stuff which lockfile is supposed to protect from * multiple access. But of course it doesn't. */ fclose(p); remove("lockfile"); Ada just makes it easier to implement this bug within a single instance of the executable. --Benjamin