[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

Re: System V IPC in standard library?

From: Steven Jenkins <steven.jenkins@...>
Date: 2006-12-21 01:36:52 UTC
List: ruby-core #9769
Nobuyoshi Nakada wrote:
> Hi,
> 
> At Wed, 20 Dec 2006 10:22:12 +0900,
> Steven Jenkins wrote in [ruby-core:09752]:
>> I don't see that conftestval is used at all in have_type. But yes,
>> that's the idea. The test code has no side effects, so an aggressively
>> optimizing compiler can throw the whole thing away. (In this case, of
>> course, the desired side effect is an error.) I looked at autoconf
>> because I figured someone else would have encountered this problem
>> before. Their code returns values to the environment, so it can't be so
>> easily optimized away.
> 
> I was forgetting fixing it at 26 Sep, therefore 1.8.5 still has
> the older test.
> 
> The current test is:
> 
>   typedef #{type} conftest_type;
>   static conftest_type conftestval[sizeof(conftest_type)?1:-1];

Whether or not any particular compiler actually does so, wouldn't it be
possible to optimize this away as well? It has no side effects. To be
sure, it seems to me you'd have to do something that the compiler can't
eliminate, like:

   typedef #{type} conftest_type;
   printf("%u\n", sizeof(conftest_type));

Beyond optimization, however, there's a deeper problem, at least in
principle. The C standard specifies only how a conforming implementation
must behave when presented with a conforming input. Such an
implementation is not required to diagnose errors or fail when presented
with a non-conforming input. Given that, it seems problematic to detect
a missing type by generating a compile-time error. I can't think of
another way, unfortunately.

I'll fix the comment so it explains better, and make the overloading of
have_type conditional on RUBY_VERSION. Thanks for the sharp eyes.

Steve

In This Thread