[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#265612: cdrom-detect: patch as requested



This patch does not apply cleanly to a current svn checkout of
debian-cd.

Osamu Aoki wrote:
> -    # If no device was detected, perhaps a driver floppy is needed.
> +    log "Try to mount a driver floppy since no auto-cdrom device found."
>      if [ -e /usr/lib/debian-installer/retriever/floppy-retriever ]; then
> -        db_input critical cdrom-detect/load_floppy
> +	db_input critical cdrom-detect/load_floppy
>  	db_go
>  	db_get cdrom-detect/load_floppy
>  	if [ "$RET" = true ]; then
> -		anna floppy-retriever
> -		hw-detect cdrom-detect/detect_progress_title || true
> -		continue
> +	    anna floppy-retriever
> +	    hw-detect cdrom-detect/detect_progress_title || true
> +	    imount=$((${imount}-1))
> +	    mounted=2
> +	    continue

That's quite an abuse of the already qite confusing $mounted variable
(mounted=1 not meaning that the CD is mounted is contrary to shell
idiom.) 2 is defined as CD is mounted but here you use it to instead
loop back through and try to mount the CD again. Setting it to 0 would
make more sense.

Note that nowhere in the code does it do anything different if $mounted
is 0 than if it is 2. So this variable could be renamd to $mount_failed,
and set to 1 if the CD faild to mount, and left at 0 otherwise.

>  	if mount -t iso9660 -o ro,exec $device /cdrom; then
> -            log "CDROM-mount succeeded: device=$device"
> -	    mounted=1
> -	    break
> -        else
> -            log "CDROM-mount failed (error=$?): device=$device"
> -            log "Unmounting CD just to be sure and giving it up."
> -            umount /cdrom 2>/dev/null || true
> +	    log "Cdrom-mount succeeded: device=$device"
> +	    db_set cdrom-detect/cdrom_device $device

This db_set would appear to be unnecessary since $device is set from
cdrom-detect/cdrom_device 7 lines above this point.

> +	    mounted=2
> +	    db_set cdrom-detect/cdrom_device $device

And doing it again is certianly unnecessary.


Can you include a changelog entry with bug closures?

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: