List Info

Thread: How to get rid of empty .bs files




How to get rid of empty .bs files
user name
2007-08-15 12:25:52
I noticed that on the windows platforms a lot of unnecessary
bootstrap 
files are created. Dynaloader says that a .bs files is
ignored if empty. 
I also assume that on Windows .bs files for dll's will
always be empty, 
because we (windows) cannot deal with unresolved symbols
("lazy 
loading"), they are resolved by LoadLibrary and DLL
stubs instead.

So I assume that we don't need to create 0 byte .bs files
for each xs 
because this will speed up dynaloader saving a stat, and a
dir entry for 
those files. And it will please us aesthetically. Maybe it
improves 
security also, because creating a LD_PRELOAD hack is harder
than 
appending to an already existing file.

Correct or am I missing something?

So how to get rid of empty .bs files?

# --- MakeMaker dynamic_bs section:
# As Mkbootstrap might not write a file (if none is
required)
# we use touch to prevent make continually trying to remake
it.
# The DynaLoader only reads a non-empty file.

$(BOOTSTRAP) : $(FIRST_MAKEFILE) $(BOOTDEP) 
                $(INST_ARCHAUTODIR)$(DFSEP).exists
	$(NOECHO) $(ECHO) "Running Mkbootstrap for 
                           $(NAME) ($(BSLOADLIBS))"
	$(NOECHO) $(PERLRUN) 
		"-MExtUtils::Mkbootstrap" 
		-e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');"
	$(NOECHO) $(TOUCH) $
	$(CHMOD) $(PERM_RW) $

$(INST_BOOT) : $(BOOTSTRAP)
$(INST_ARCHAUTODIR)$(DFSEP).exists
	$(NOECHO) $(RM_RF) $
	- $(CP) $(BOOTSTRAP) $
	$(CHMOD) $(PERM_RW) $

Ok, let's touch it locally to be able to run $(BOOTSTRAP)
which MIGHT 
actually pull in some code.
But get rid of INST_BOOT as dependency of dynamic -
INST_DYNAMIC is 
enough - and skip copying an empty file.

Currently I do this in MM_Unix
     # copy .bs only if non-empty	
     push m, <<'MAKE';
	$(CHMOD) $(PERM_RWX) $
	$(NOECHO) $(RM_RF) $(BOOTSTRAP)
	- $(TEST_S) $(BOOTSTRAP) && $(CP) $(BOOTSTRAP)
$(INST_BOOT) && 
	  $(CHMOD) $(PERM_RW) $(INST_BOOT)

This leaves us with Error 1 (ignored)
   test -s B.bs && cp B.bs ../../lib/auto/B/B.bs
&& 
           chmod 644 ../../lib/auto/B/B.bs
make[1]: [../../lib/auto/B/B.dll] Error 1 (ignored)
   flagging that .bs was not copied. Hmm.

Portability:
TEST_S is easy, but the '&&' logic?
Shouldn't we use a
   ABSPERLRUN -MExtUtils::Command -e cp_nonempty (PERM FROM
TO)
Or maybe only on non-unix platforms?
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/

  
Re: How to get rid of empty .bs files
user name
2007-08-31 08:05:58
On 15/08/2007, Reini Urban <rurbanx-ray.at> wrote:
> I noticed that on the windows platforms a lot of
unnecessary bootstrap
> files are created. Dynaloader says that a .bs files is
ignored if empty.
> I also assume that on Windows .bs files for dll's will
always be empty,
> because we (windows) cannot deal with unresolved
symbols ("lazy
> loading"), they are resolved by LoadLibrary and
DLL stubs instead.
>
> So I assume that we don't need to create 0 byte .bs
files for each xs
> because this will speed up dynaloader saving a stat,
and a dir entry for
> those files. And it will please us aesthetically. Maybe
it improves
> security also, because creating a LD_PRELOAD hack is
harder than
> appending to an already existing file.

I think that .bs files are largely like vestigial organs,
testifying
about an ancient stage of the Unix platforms evolution. We
might
consider getting rid of them, completely stopping generating
them. But
after 5.10.0 is released.

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )