Chicken Scheme release tarballs ship non-source C code

  • Open
  • quality assurance status badge
Details
3 participants
  • Thompson, David
  • Mario Domenech Goulart
  • zimoun
Owner
unassigned
Submitted by
Thompson, David
Severity
normal
T
T
Thompson, David wrote on 13 Jan 2016 19:54
(address . bug-guix@gnu.org)
CAJ=RwfbrqdFqnSAMHDHG_6vsSr7R3QcPGjg6Eu2bzseBjTaeNQ@mail.gmail.com
Because Chicken Scheme's compiler is self-hosting, and because it
compiles to C as an intermediate form, the maintainers circumvented
the bootstrapping problem by shipping generated C code for the
compiler. Many *.c files feature a comment that starts like this:

Generated from optimizer.scm by the CHICKEN compiler

This is *not* source code, it's a binary disguised as C source code.

To resolve this bug, we need to delete these generated files from the
source tarball and figure out how to bootstrap Chicken without them.
Maybe someone who actively uses Chicken knows how to do this?

- Dave
Z
Z
zimoun wrote on 13 May 2020 01:33
CAJ3okZ2MQ0vfbUYMkk7iFgua6cnEYF94r4pVq6frQfZe0aOGFA@mail.gmail.com
Dear David,

The bug report [1] opened more than 4 years ago about the Chicken
bootstrapping is still pending.

I am not sure to understand these lines; quoting you [1]:

<<
Generated from optimizer.scm by the CHICKEN compiler

This is *not* source code, it's a binary disguised as C source code.
Toggle quote (2 lines)
>>

Why is it an issue for bootstrappability?


Thank you in advance for any comments.
Or could this bug report be closed?

All the best,
simon

T
T
Thompson, David wrote on 14 May 2020 21:04
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 22366@debbugs.gnu.org)
CAJ=RwfYs5AmO=nsEEqVJW0chcTCq94iBapOd8ab8ECKh9odTjA@mail.gmail.com
On Tue, May 12, 2020 at 7:33 PM zimoun <zimon.toutoune@gmail.com> wrote:
Toggle quote (16 lines)
>
> Dear David,
>
> The bug report [1] opened more than 4 years ago about the Chicken
> bootstrapping is still pending.
>
> I am not sure to understand these lines; quoting you [1]:
>
> <<
> Generated from optimizer.scm by the CHICKEN compiler
>
> This is *not* source code, it's a binary disguised as C source code.
> >>
>
> Why is it an issue for bootstrappability?

Because software is not bootstrappable if it requires taking for
granted files that are not source code. In this case, it is these C
files. These files are not source code because they are machine
generated. In order to generate these files, you need a Chicken
Scheme compiler. Therefore, you cannot build Chicken Scheme from
source code without already having Chicken Scheme, which makes it
non-bootstrappable. I have not kept track of this issue but my
understanding was that the Chicken developers do not care (which is
unfortunately a very common reaction from developers of self-hosted
compilers) but it is nevertheless a bootstrapping issue.

Toggle quote (3 lines)
> Thank you in advance for any comments.
> Or could this bug report be closed?

I don't think this can be closed because it is still an issue.

- Dave
Z
Z
zimoun wrote on 15 May 2020 12:15
(name . Thompson, David)(address . dthompson2@worcester.edu)(address . 22366@debbugs.gnu.org)
CAJ3okZ3Y0uiEd6zX6Y8wLUG8=VM5T9vxoH1=cfAXZaNdaaxQjA@mail.gmail.com
Dear David,

On Thu, 14 May 2020 at 21:04, Thompson, David <dthompson2@worcester.edu> wrote:

Toggle quote (13 lines)
> > Why is it an issue for bootstrappability?
>
> Because software is not bootstrappable if it requires taking for
> granted files that are not source code. In this case, it is these C
> files. These files are not source code because they are machine
> generated. In order to generate these files, you need a Chicken
> Scheme compiler. Therefore, you cannot build Chicken Scheme from
> source code without already having Chicken Scheme, which makes it
> non-bootstrappable. I have not kept track of this issue but my
> understanding was that the Chicken developers do not care (which is
> unfortunately a very common reaction from developers of self-hosted
> compilers) but it is nevertheless a bootstrapping issue.

I am not following your reasoning. The point is not how the C files
are generated but if they are auditable. -- which in most of the cases
means human-readable.

Considering these generated C files, even if I am not a C expert, they
seems un-auditable.

Toggle snippet (42 lines)
C_noret_decl(f24858)
static void C_ccall f24858(C_word c,C_word *av) C_noret;
C_noret_decl(f_10015)
static void C_ccall f_10015(C_word c,C_word *av) C_noret;
C_noret_decl(f_10019)

[...]

/* k10021 in k10017 in a10014 in k9990 in k9987 in k9984 in k8730 in
k8463 in k8451 in k8448 in k8445 in k8441 in k8438 in k8432 in k8393
in walk in chicken.compiler.core#canonicalize-expression in k6295 in
k6292 in k6289 in k6286 in k6283 in ... */
static void C_ccall f_10023(C_word c,C_word *av){
C_word tmp;
C_word t0=av[0];
C_word t1=av[1];
C_word t2;
C_word t3;
C_word t4;
C_word *a;
if(C_unlikely(!C_demand(C_calculate_demand(4,c,4)))){
C_save_and_reclaim((void *)f_10023,c,av);}
a=C_alloc(4);
t2=C_mutate(((C_word *)((C_word*)t0)[2])+1,t1);
t3=(*a=C_CLOSURE_TYPE|3,a[1]=(C_word)f_10026,a[2]=((C_word*)t0)[3],a[3]=((C_word*)t0)[4],tmp=(C_word)a,a+=4,tmp);
/* core.scm:890: ##sys#current-environment1643 */
t4=((C_word*)t0)[5];{
C_word *av2;
if(c >= 5) {
av2=av;
} else {
av2=C_alloc(5);
}
av2[0]=t4;
av2[1]=t3;
av2[2]=((C_word*)t0)[6];
av2[3]=C_SCHEME_FALSE;
av2[4]=C_SCHEME_TRUE;
((C_proc)(void*)(*((C_word*)t4+1)))(5,av2);}}


Toggle quote (2 lines)
> I don't think this can be closed because it is still an issue.

I have failed to generated these C files using another scheme
interpreter. Yeah, it is more than a hack between the coffee and the
shower. :-)


Thank you for the clarifications and it is still an issue. :-)

All the best,
simon
M
M
Mario Domenech Goulart wrote on 17 Aug 2021 11:13
Re: Chicken Scheme release tarballs ship non-source C code
(address . 22366@debbugs.gnu.org)
874kbo3030.fsf@parenteses.org
Hi,

That's a valid point, David. I've created
http://bugs.call-cc.org/ticket/1776for the issue you pointed out.

As far as I can tell, it's a tricky issue. Regarding "my
understanding was that the Chicken developers do not care", and
speaking for myself, I think that's a misunderstanding. Please
consider that CHICKEN is developed by [a few] volunteers. I think we
would all agree that it would be great to have an easily scrutable
source code, but we are not there. Contributions to improve that are
welcome, of course.

(I tried to post this comment via the form in
http://issues.guix.gnu.org/22366, but apparently that hasn't worked --
trying e-mail now)

All the best.
Mario
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 22366@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 22366
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch