segfault bb_make_directory + dirname with musl

2016-11-29 Thread Daniel Sabogal
The following commands cause busybox to segfault on musl-based systems.

$ install -D a /
$ install -D a /b
$ install -D a /b/

This happens because the code in

https://git.busybox.net/busybox/tree/coreutils/install.c?h=1_25_1#n196

passes the result of dirname() to bb_make_directory() which modifies its
contents. For paths of the above forms, musl's dirname returns a string
literal "/" which shouldn't be modified.

See http://git.musl-libc.org/cgit/musl/tree/src/misc/dirname.c

There are a few other occurrences of the code shown above, but I've not
checked to see if they could be made to segfault.
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Shell script silently exits. Why?

2016-11-29 Thread Cristian Ionescu-Idbohrn
On Tue, 29 Nov 2016, Pavel A wrote:
>
> Is it possible to test for active option within ash script?
> My version of ash does not seem to recognize "test -o" or [ -o errexit ]

To test on errexit you'd do something like:

case $- in
*e*)
echo errexit set
;;
*)
echo errexit not set
;;
esac

The $- thing:

Special Parameters

 - (Hyphen.)  Expands to the current option flags (the single-letter
  option names concatenated into a string) as specified on
  invocation, by the set builtin command, or implicitly by the
  shell.


Cheers,

-- 
Cristian
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: Shell script silently exits. Why?

2016-11-29 Thread Pavel A
Apologies for late response and thanks for everyone who pointed to the behavior 
of let command with zero result. 

Is it possible to test for active option within ash script?
My version of ash does not seem to recognize "test -o" or [ -o errexit ]

Grepping my scripts does not find the -e option set. 
Anyway I'm replacing all let commands to $(()) based on opinion on 
StackOverflow that "let" is not posix-blessed. 

Thanks, 
Pavel A. 

> On 17 Nov 2016, at 17:49, Bastian Bittorf  wrote:
> 
> * Pavel A  [17.11.2016 16:47]:
>> We checked that the script does not contain weird unprintable characters and 
>> other obvious things. Just plain ascii.
> 
> try with 'set -x' ontop of your script and check the last lines when 
> executing it.
> also: does 'sh -n your_file.sh' complains?
> 
> bye, bastian
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


Re: [PATCH] fdisk: Add support for GPT partition type codes

2016-11-29 Thread Mattias Schlenker

Am 29.11.2016 um 08:58 schrieb James Bowlin:


Aside from size constraints, etc, all four combinations work:

   o UEFI booting on GPT partitioning
   o UEFI booting on MSDOS partitioning
   o Legacy booting on GPT partitioning
   o Legacy booting on MSDOS partitioning

For example, my live-usb-maker script:
https://github.com/BitJam/live-usb-maker  boots via both legacy
and UEFI and it can be set to partition with GPT or MSDOS.


In theory they work and in practice in 99% of the cases when booting 
internal hard drives. My preferred boot configuration on all PC systems 
are GPT partitioned drives with a partition markes EFI system and one 
marked legacy boot (might apply to the same partition) and using 
gptmbr.bin from syslinux to boot.


In practice there are some early EFIs (ca. 2007 to 2010) that are 
disguised as BIOS that ignore the 448 byte boot block on USB drives and 
instead look for a MBR partition table and one partition marked as 
active. Because of the protective MBR they won't boot a GPT partitioned 
stick. Something similar applies to many 32 bit UEFIs (cheap Intel 
tablets and netbooks). To boot from external media those expect a single 
partition drive, MBR partition table and the partition flagged as (EFI 
system partition) containing all the boot files. This might violate the 
UEFI standards, but I guess since Windows bootable USB drives use 
exactly this single partition MBR layout, no one cares in practice.


Yours,
Mattias

--
Mattias Schlenker - Freier IT-Fachredakteur und -autor
 redakt...@mattiasschlenker.de
Mattias Schlenker - IT-Consulting, Softwareentwicklung
consult...@mattiasschlenker.de

Address__ August-Bebel-Str. 74 - D-04275 LEIPZIG - GERMANY
Phone: +49 341 39290767  Fax: +49 341 30393578
Mobile: +49 163  6953657  Another mobile: +49 159 03160327
VATIN_ DE240998538

Fork me! https://github.com/mschlenker
Website.__ http://www.mattiasschlenker.de/
My books!___ http://www.arduino-hausautomation.de/

___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox