ftalamo1 | 30 Jun 16:50 2015
Picon

help

Dear Busybox

No installation is possible on ROM Version LRX21V.ASUS_T00J_WW_user_323.40.52_20150522_91

Please help me.

Thanks.

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Bernhard Reutner-Fischer | 29 Jun 09:30 2015
Picon

Re: [Bug 8186] man displays raw ANSI code for color escapes because of missing less -R

On June 28, 2015 2:02:57 PM GMT+02:00, bugzilla <at> busybox.net wrote:
>https://bugs.busybox.net/show_bug.cgi?id=8186
>

http://lists.busybox.net/pipermail/busybox/2014-January/080362.html

And following thread. bikeshedding.

Thanks,
Pratik Prajapati | 26 Jun 13:15 2015
Picon

Re: How to do array operation in busybox

I tried your solution but couldn't print that array:

for index in 1 2 3 ; do
      eval echo \$LST$index
done



On Fri, Jun 26, 2015 at 3:27 PM, walter harms <wharms <at> bfs.de> wrote:



Am 26.06.2015 11:07, schrieb Pratik Prajapati:
> Thanks. Your solution is very useful.
>

a more shell like solution is simple using a $IFS separated list
and the power of set but if you have sparse values and you need the gaps
you are better of with this solution.

For the example you could do something like:
LST=""
for NAME in ARG
do
        LST=$LST" "$NAME
done

just my 2 cents,
re,
 wh


> On Fri, Jun 26, 2015 at 12:01 PM, Sven-Göran Bergh <
> sgb-list+busybox <at> systemaxion.se> wrote:
>
>> On 06/26/2015 07:59 AM, Pratik Prajapati wrote:
>>
>>> I tried one method and was unable to correct it. Can you give me the
>>> correct method ?
>>>
>>> On Fri, Jun 26, 2015 at 11:25 AM, Sven-Göran Bergh
>>> <sgb-list+busybox <at> systemaxion.se
>>> <mailto:sgb-list+busybox <at> systemaxion.se>> wrote:
>>>
>>>     Hi Patrik
>>>
>>>     On 06/26/2015 07:49 AM, Pratik Prajapati wrote:
>>>
>>>         Hi,
>>>
>>>         I am working on LTP-DDT project (
>>> https://github.com/rogerq/ltp-ddt)
>>>         which i cross-compiled for my target and my target uses busybox.
>>> But
>>>         running it on my target gives me error as array operation is not
>>>         supported in busybox.
>>>
>>>         I have attached script with this mail.
>>>
>>>         I am getting error for :
>>>
>>>         sh: /opt/ltp/testcases/bin/ddt/common/common.sh: line 305:
>>>         syntax error:
>>>         bad substitution
>>>
>>>         I tried this:
>>>
>>>         |305: shift
>>>         306: index=0
>>>         307: for  arg;
>>>         308: do
>>>         309:   x[$index]=$arg
>>>         310:   ((index++))
>>>         311: done
>>>
>>
>> I am afraid that the work around is quite ugly. In this case
>> you may use the evil eval:
>>
>> index=0
>> for arg;
>> do
>>         eval x${index}=$arg
>>         eval printf "x%s:\\\t%s\\\n" "${index}" "\$x${index}"
>>         ((index++))
>> done
>>
>> Yes, I know it is ugly and I said so.
>> Arrays are one of the things I miss the most in ash.
>>
>> Brgds
>> /S-G
>>
>>
>>          |but i got error:|  syntax error: unexpected "(" (expecting "}")
>>>
>>>         Also couldn't found any solution on google.
>>>
>>>         How to make it work on busybox. Please help.
>>>
>>>
>>>     Arrays is a bash feature, it is not supported by ash or standard
>>>     shells. So unfortunately the short answer is that it does not work.
>>>     However there are often ways to rework a script to avoid arrays.
>>>
>>>     Brgds
>>>     /S-G
>>>
>>>
>>>         Thanks,
>>>
>>>         Pratik
>>>
>>>
>>>
>>>         _______________________________________________
>>>         busybox mailing list
>>>         busybox <at> busybox.net <mailto:busybox <at> busybox.net>
>>>         http://lists.busybox.net/mailman/listinfo/busybox
>>>
>>>
>>>
>>
>
>
>
> _______________________________________________
> busybox mailing list
> busybox <at> busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Pratik Prajapati | 26 Jun 07:49 2015
Picon

How to do array operation in busybox

Hi,

I am working on LTP-DDT project (https://github.com/rogerq/ltp-ddt) which i cross-compiled for my target and my target uses busybox. But running it on my target gives me error as array operation is not supported in busybox.

I have attached script with this mail.

I am getting error for :

sh: /opt/ltp/testcases/bin/ddt/common/common.sh: line 305: syntax error: bad substitution

I tried this:
305: shift
306: index
=0 307: for arg; 308: do 309: x[$index]=$arg 310: ((index++)) 311: done

but i got error: syntax error: unexpected "(" (expecting "}")

Also couldn't found any solution on google.
How to make it work on busybox. Please help.

Thanks,
Pratik
Attachment (common.zip): application/zip, 5928 bytes
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Pratik Prajapati | 26 Jun 07:37 2015
Picon

How to do array operation in busybox

Hi,

I am working on LTP-DDT project (https://github.com/rogerq/ltp-ddt) which i cross-compiled for my target and my target uses busybox. But running it on my target gives me error as array operation is not supported in busybox.

I have attached script with this mail.

I am getting error for :

sh: /opt/ltp/testcases/bin/ddt/common/common.sh: line 305: syntax error: bad substitution

I tried this:
305: shift
306: index
=0 307: for arg; 308: do 309: x[$index]=$arg 310: ((index++)) 311: done

but i got error: syntax error: unexpected "(" (expecting "}")

Also couldn't found any solution on google.
How to make it work on busybox. Please help.

Thanks,
Pratik





Attachment (common.sh): application/x-sh, 13 KiB
_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Bastian Bittorf | 24 Jun 23:03 2015

ash / shell scripting question / abort after Arithmetic Evaluation

we stumbled over an interesting behaviour,
which is the same like in bash, but new to us:

root <at> box:~ a=120; echo $(( a / 60 )); echo HERE
2
HERE

root <at> box:~ a=; echo $(( a / 60 )); echo HERE
0
HERE

root <at> box:~ a=; echo $(( $a / 60 )); echo HERE
-ash: arithmetic syntax error

root <at> box:~ echo $(( / 60 )); echo HERE
-ash: arithmetic syntax error

can somebody explain, why the execution stopped
totally in the last 2 examples? this was the root-cause
for a not removed 'lock'-dir in one of our scripts...

bye, bastian
Maninder Singh | 10 Jun 12:24 2015

[PATCH v2] kernel:flock: Change tst_resm() followed by tst_exit() to tst_brkm()

As in commit 9fa8ad0 Change tst_resm() followed by tst_exit() to tst_brkm()

Signed-off-by: Maninder Singh <maninder1.s <at> samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k <at> samsung.com>
---
 testcases/kernel/syscalls/flock/flock01.c |   12 ++----------
 testcases/kernel/syscalls/flock/flock06.c |   10 ++--------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/testcases/kernel/syscalls/flock/flock01.c b/testcases/kernel/syscalls/flock/flock01.c
index c010608..44b30d1 100644
--- a/testcases/kernel/syscalls/flock/flock01.c
+++ b/testcases/kernel/syscalls/flock/flock01.c
 <at>  <at>  -156,16 +156,8  <at>  <at>  void setup(void)

 	/* creating temporary file */
 	fd = creat(filename, 0644);
-	if (fd < 0) {
-		tst_resm(TFAIL, "creating a new file failed");
-
-		/* Removing temp directory */
-		tst_rmdir();
-
-		/* exit with resturn code appropriate for result */
-		tst_exit();
-
-	}
+	if (fd < 0)
+		tst_brkm(TFAIL, tst_rmdir, "creating a new file failed");
 }

 /*
diff --git a/testcases/kernel/syscalls/flock/flock06.c b/testcases/kernel/syscalls/flock/flock06.c
index 1f1e9c3..0065c53 100644
--- a/testcases/kernel/syscalls/flock/flock06.c
+++ b/testcases/kernel/syscalls/flock/flock06.c
 <at>  <at>  -160,14 +160,8  <at>  <at>  void setup(void)

 	/* creating temporary file */
 	fd = creat(filename, 0666);
-	if (fd < 0) {
-		tst_resm(TFAIL, "creating a new file failed");
-
-		/* Removing temp dir */
-		tst_rmdir();
-
-		tst_exit();
-	}
+	if (fd < 0)
+		tst_brkm(TFAIL, tst_rmdir, "creating a new file failed");
 	close(fd);
 }

--

-- 
1.7.9.5
Maninder Singh | 10 Jun 11:49 2015

[RFC][PATCH 1/1] procps/nmeter.c: change (type*)0 to NULL

Use NULL instead of (type*)0 as in init_delay

Signed-off-by: Maninder Singh <maninder1.s <at> samsung.com>
Reviewed-by: Akhilesh Kumar <akhilesh.k <at> samsung.com>
---
 procps/nmeter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/procps/nmeter.c b/procps/nmeter.c
index 5d5b83b..c45864a 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
 <at>  <at>  -370,7 +370,7  <at>  <at>  static s_stat* init_delay(const char *param)
 static s_stat* init_cr(const char *param UNUSED_PARAM)
 {
 	final_str = "\r";
-	return (s_stat*)0;
+	return NULL;
 }

 
--

-- 
1.7.1
Marc Kleine-Budde | 10 Jun 11:26 2015
Picon

[PATCH 1/3] Fix the format warning when building applets/usage_pod.c

From: Dinny Wu <dinny.wu <at> gmail.com>

When compiling busybox with gcc 4.6.3, it shows below warning:

applets/usage_pod.c: In function ‘main’:
applets/usage_pod.c:74:3: warning: format not a string literal and no format arguments [-Wformat-security]

Signed-off-by: Dinny Wu <dinny.wu <at> gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl <at> pengutronix.de>
---
 applets/usage_pod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/applets/usage_pod.c b/applets/usage_pod.c
index 0b1c4aadb8c4..a67e8b4ac348 100644
--- a/applets/usage_pod.c
+++ b/applets/usage_pod.c
 <at>  <at>  -71,7 +71,7  <at>  <at>  int main(void)
 		} else {
 			printf(", ");
 		}
-		printf(usage_array[i].aname);
+		printf("%s", usage_array[i].aname);
 		col += len2;
 	}
 	printf("\n\n");
--

-- 
2.1.4

_______________________________________________
busybox mailing list
busybox <at> busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Maninder Singh | 10 Jun 05:47 2015

[RESEND][PATCH 1/1] Removes stray empty line from code

From: Maninder Singh <maninder1.s <at> samsung.com>

This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines

Signed-off-by: Maninder Singh <maninder1.s <at> samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k <at> samsung.com>
---
 archival/cpio.c                             |    1 -
 archival/gzip.c                             |    3 ---
 archival/libarchive/bz/compress.c           |    1 -
 archival/libarchive/decompress_uncompress.c |    1 -
 archival/libarchive/lzo1x_9x.c              |    1 -
 archival/libarchive/unxz/xz_dec_lzma2.c     |    3 ---
 archival/libarchive/unxz/xz_dec_stream.c    |    2 --
 archival/unzip.c                            |    2 --
 console-tools/showkey.c                     |    1 -
 coreutils/ln.c                              |    1 -
 editors/awk.c                               |   12 ------------
 editors/ed.c                                |    1 -
 editors/vi.c                                |    1 -
 libbb/appletlib.c                           |    1 -
 libbb/in_ether.c                            |    1 -
 libbb/procps.c                              |    1 -
 libbb/xfuncs.c                              |    1 -
 mailutils/reformime.c                       |    1 -
 miscutils/crontab.c                         |    1 -
 networking/arp.c                            |    1 -
 networking/ntpd.c                           |    1 -
 networking/tftp.c                           |    1 -
 networking/wget.c                           |    1 -
 selinux/setfiles.c                          |    1 -
 shell/ash.c                                 |    2 --
 shell/hush.c                                |    1 -
 shell/shell_common.c                        |    1 -
 sysklogd/syslogd.c                          |    1 -
 28 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/archival/cpio.c b/archival/cpio.c
index 454648d..cdc16c1 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
 <at>  <at>  -257,7 +257,6  <at>  <at>  static NOINLINE int cpio_o(void)
 				free(line);
 				continue;
 			}
-
 		} else { /* line == NULL: EOF */
  next_link:
 			if (links) {
diff --git a/archival/gzip.c b/archival/gzip.c
index 42b2f0b..c917130 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
 <at>  <at>  -1372,7 +1372,6  <at>  <at>  static void build_tree(tree_desc * desc)
 		/* and insert the new node in the heap */
 		G2.heap[SMALLEST] = node++;
 		pqdownheap(tree, SMALLEST);
-
 	} while (G2.heap_len >= 2);

 	G2.heap[--G2.heap_max] = G2.heap[SMALLEST];
 <at>  <at>  -1720,7 +1719,6  <at>  <at>  static ulg flush_block(char *buf, ulg stored_len, int eof)

 		copy_block(buf, (unsigned) stored_len, 0);	/* without header */
 		G2.compressed_len = stored_len << 3;
-
 	} else if (stored_len + 4 <= opt_lenb && buf != NULL) {
 		/* 4: two words for the lengths */
 		/* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
 <at>  <at>  -1734,7 +1732,6  <at>  <at>  static ulg flush_block(char *buf, ulg stored_len, int eof)
 		G2.compressed_len += (stored_len + 4) << 3;

 		copy_block(buf, (unsigned) stored_len, 1);	/* with header */
-
 	} else if (static_lenb == opt_lenb) {
 		send_bits((STATIC_TREES << 1) + eof, 3);
 		compress_block((ct_data *) G2.static_ltree, (ct_data *) G2.static_dtree);
diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c
index 23de9d3..2d99468 100644
--- a/archival/libarchive/bz/compress.c
+++ b/archival/libarchive/bz/compress.c
 <at>  <at>  -385,7 +385,6  <at>  <at>  void sendMTFValues(EState* s)
 				cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
 				cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
 				cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
-
 			} else
 #endif
 			{
diff --git a/archival/libarchive/decompress_uncompress.c b/archival/libarchive/decompress_uncompress.c
index 496d864..034ed50 100644
--- a/archival/libarchive/decompress_uncompress.c
+++ b/archival/libarchive/decompress_uncompress.c
 <at>  <at>  -297,7 +297,6  <at>  <at>  unpack_Z_stream(transformer_state_t *xstate)
 			/* Remember previous code.  */
 			oldcode = incode;
 		}
-
 	} while (rsize > 0);

 	if (outpos > 0) {
diff --git a/archival/libarchive/lzo1x_9x.c b/archival/libarchive/lzo1x_9x.c
index 2b490ae..09ee4ba 100644
--- a/archival/libarchive/lzo1x_9x.c
+++ b/archival/libarchive/lzo1x_9x.c
 <at>  <at>  -71,7 +71,6  <at>  <at>  typedef struct {
 	uint8_t *out;

 	unsigned r1_lit;
-
 } lzo1x_999_t;

 #define getbyte(c)  ((c).ip < (c).in_end ? *((c).ip)++ : (-1))
diff --git a/archival/libarchive/unxz/xz_dec_lzma2.c b/archival/libarchive/unxz/xz_dec_lzma2.c
index 3c2dc88..351251f 100644
--- a/archival/libarchive/unxz/xz_dec_lzma2.c
+++ b/archival/libarchive/unxz/xz_dec_lzma2.c
 <at>  <at>  -995,10 +995,8  <at>  <at>  XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run(
 					s->lzma2.need_props = false;
 					s->lzma2.next_sequence
 							= SEQ_PROPERTIES;
-
 				} else if (s->lzma2.need_props) {
 					return XZ_DATA_ERROR;
-
 				} else {
 					s->lzma2.next_sequence
 							= SEQ_LZMA_PREPARE;
 <at>  <at>  -1080,7 +1078,6  <at>  <at>  XZ_EXTERN NOINLINE enum xz_ret XZ_FUNC xz_dec_lzma2_run(

 				rc_reset(&s->rc);
 				s->lzma2.sequence = SEQ_CONTROL;
-
 			} else if (b->out_pos == b->out_size
 					|| (b->in_pos == b->in_size
 						&& s->temp.size
diff --git a/archival/libarchive/unxz/xz_dec_stream.c b/archival/libarchive/unxz/xz_dec_stream.c
index bdcbf1b..bf79105 100644
--- a/archival/libarchive/unxz/xz_dec_stream.c
+++ b/archival/libarchive/unxz/xz_dec_stream.c
 <at>  <at>  -353,7 +353,6  <at>  <at>  static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b)
 			return XZ_DATA_ERROR;

 		s->pos += 8;
-
 	} while (s->pos < 32);

 	s->crc32 = 0;
 <at>  <at>  -753,7 +752,6  <at>  <at>  XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_run(struct xz_dec *s, struct xz_buf *b)
 			b->in_pos = in_start;
 			b->out_pos = out_start;
 		}
-
 	} else if (ret == XZ_OK && in_start == b->in_pos
 			&& out_start == b->out_pos) {
 		if (s->allow_buf_error)
diff --git a/archival/unzip.c b/archival/unzip.c
index eed2256..f41ab6f 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
 <at>  <at>  -604,7 +604,6  <at>  <at>  int unzip_main(int argc, char **argv)
 		 || (zaccept && !find_list_entry(zaccept, dst_fn))
 		) { /* Skip entry */
 			i = 'n';
-
 		} else {
 			if (listing) {
 				/* List entry */
 <at>  <at>  -666,7 +665,6  <at>  <at>  int unzip_main(int argc, char **argv)
 					}
 				}
 				i = 'n';
-
 			} else {
 				/* Extract file */
  check_file:
diff --git a/console-tools/showkey.c b/console-tools/showkey.c
index 69b785e..b7b4c32 100644
--- a/console-tools/showkey.c
+++ b/console-tools/showkey.c
 <at>  <at>  -83,7 +83,6  <at>  <at>  int showkey_main(int argc UNUSED_PARAM, char **argv)
 			if (04 /*CTRL-D*/ == c)
 				break;
 		}
-
 	} else {
 		// we assume a PC keyboard
 		xioctl(STDIN_FILENO, KDGKBMODE, &kbmode);
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 3b822e8..1688148 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
 <at>  <at>  -134,7 +134,6  <at>  <at>  int ln_main(int argc, char **argv)
 		}

 		free(src_name);
-
 	} while ((++argv)[1]);

 	return status;
diff --git a/editors/awk.c b/editors/awk.c
index f487163..9c6819a 100644
--- a/editors/awk.c
+++ b/editors/awk.c
 <at>  <at>  -1060,12 +1060,10  <at>  <at>  static uint32_t next_token(uint32_t expected)

 	if (t_rollback) {
 		t_rollback = FALSE;
-
 	} else if (concat_inserted) {
 		concat_inserted = FALSE;
 		t_tclass = save_tclass;
 		t_info = save_info;
-
 	} else {
 		p = g_pos;
  readnext:
 <at>  <at>  -1081,7 +1079,6  <at>  <at>  static uint32_t next_token(uint32_t expected)
 		if (*p == '\0') {
 			tc = TC_EOF;
 			debug_printf_parse("%s: token found: TC_EOF\n", __func__);
-
 		} else if (*p == '\"') {
 			/* it's a string */
 			t_string = s = ++p;
 <at>  <at>  -1097,7 +1094,6  <at>  <at>  static uint32_t next_token(uint32_t expected)
 			*s = '\0';
 			tc = TC_STRING;
 			debug_printf_parse("%s: token found:'%s' TC_STRING\n", __func__, t_string);
-
 		} else if ((expected & TC_REGEXP) && *p == '/') {
 			/* it's regexp */
 			t_string = s = ++p;
 <at>  <at>  -1130,7 +1126,6  <at>  <at>  static uint32_t next_token(uint32_t expected)
 				syntax_error(EMSG_UNEXP_TOKEN);
 			tc = TC_NUMBER;
 			debug_printf_parse("%s: token found:%f TC_NUMBER\n", __func__, t_double);
-
 		} else {
 			/* search for something known */
 			tl = tokenlist;
 <at>  <at>  -1580,12 +1575,10  <at>  <at>  static void parse_program(char *p)
 			debug_printf_parse("%s: TC_BEGIN\n", __func__);
 			seq = &beginseq;
 			chain_group();
-
 		} else if (tclass & TC_END) {
 			debug_printf_parse("%s: TC_END\n", __func__);
 			seq = &endseq;
 			chain_group();
-
 		} else if (tclass & TC_FUNCDECL) {
 			debug_printf_parse("%s: TC_FUNCDECL\n", __func__);
 			next_token(TC_FUNCTION);
 <at>  <at>  -1603,7 +1596,6  <at>  <at>  static void parse_program(char *p)
 			seq = &f->body;
 			chain_group();
 			clear_array(ahash);
-
 		} else if (tclass & TC_OPSEQ) {
 			debug_printf_parse("%s: TC_OPSEQ\n", __func__);
 			rollback_token();
 <at>  <at>  -1618,7 +1610,6  <at>  <at>  static void parse_program(char *p)
 				chain_node(OC_PRINT);
 			}
 			cn->r.n = mainseq.last;
-
 		} else /* if (tclass & TC_GRPSTART) */ {
 			debug_printf_parse("%s: TC_GRPSTART(?)\n", __func__);
 			rollback_token();
 <at>  <at>  -1879,13 +1870,10  <at>  <at>  static void handle_special(var *v)
 		split_f0();

 		mk_splitter(getvar_s(v), &fsplitter);
-
 	} else if (v == intvar[RS]) {
 		mk_splitter(getvar_s(v), &rsplitter);
-
 	} else if (v == intvar[IGNORECASE]) {
 		icase = istrue(v);
-
 	} else {				/* $n */
 		n = getvar_i(intvar[NF]);
 		setvar_i(intvar[NF], n > v-Fields ? n : v-Fields+1);
diff --git a/editors/ed.c b/editors/ed.c
index 3087fb0..f0e5e4d 100644
--- a/editors/ed.c
+++ b/editors/ed.c
 <at>  <at>  -732,7 +732,6  <at>  <at>  static int readLines(const char *file, int num)
 		cc = safe_read(fd, bufPtr, bufSize - bufUsed);
 		bufUsed += cc;
 		bufPtr = bufBase;
-
 	} while (cc > 0);

 	if (cc < 0) {
diff --git a/editors/vi.c b/editors/vi.c
index 6ce513c..3db597a 100644
--- a/editors/vi.c
+++ b/editors/vi.c
 <at>  <at>  -411,7 +411,6  <at>  <at>  struct globals {
 		char undo_text[1];	// text that was deleted (if deletion)
 	} *undo_stack_tail;
 #endif /* ENABLE_FEATURE_VI_UNDO */
-
 };
 #define G (*ptr_to_globals)
 #define text           (G.text          )
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 46849e4..24253cf 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
 <at>  <at>  -457,7 +457,6  <at>  <at>  static void parse_config_file(void)
 			errmsg = "keyword outside section";
 			goto pe_label;
 		}
-
 	} /* while (1) */

  pe_label:
diff --git a/libbb/in_ether.c b/libbb/in_ether.c
index 1de383b..161c8ea 100644
--- a/libbb/in_ether.c
+++ b/libbb/in_ether.c
 <at>  <at>  -51,7 +51,6  <at>  <at>  int FAST_FUNC in_ether(const char *bufp, struct sockaddr *sap)
 		} while (j);

 		*ptr++ = val;
-
 	} while (--i);

 	/* Error if we aren't at end of string */
diff --git a/libbb/procps.c b/libbb/procps.c
index 948b91e..3d335b3 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
 <at>  <at>  -614,7 +614,6  <at>  <at>  void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm)
 			buf[comm_len - 1] = ' ';
 			buf[col - 1] = '\0';
 		}
-
 	} else {
 		snprintf(buf, col, "[%s]", comm);
 	}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index f25ce94..0c99696 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
 <at>  <at>  -207,7 +207,6  <at>  <at>  off_t FAST_FUNC fdlength(int fd)
 			else bottom = pos;

 		// If we can't, it's smaller.
-
 		} else {
 			if (bottom == top) {
 				if (!top) return 0;
diff --git a/mailutils/reformime.c b/mailutils/reformime.c
index 8e7d455..86b2cfe 100644
--- a/mailutils/reformime.c
+++ b/mailutils/reformime.c
 <at>  <at>  -134,7 +134,6  <at>  <at>  static int parse(const char *boundary, char **argv)
 			if (strcasecmp(type + 10, "mixed") != 0)
 				bb_error_msg_and_die("no support of content type '%s'", type);
 			parse(xfind_token(tokens, "boundary"), argv);
-
 		} else {
 			/* No, process one non-multipart section */
 			char *end;
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index aad242f..85c6623 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
 <at>  <at>  -170,7 +170,6  <at>  <at>  int crontab_main(int argc UNUSED_PARAM, char **argv)
 			unlink(tmp_fname);
 		/*free(tmp_fname);*/
 		/*free(new_fname);*/
-
 	} /* switch */

 	/* Bump notification file.  Handle window where crond picks file up
diff --git a/networking/arp.c b/networking/arp.c
index e79b1b6..0099aa5 100644
--- a/networking/arp.c
+++ b/networking/arp.c
 <at>  <at>  -68,7 +68,6  <at>  <at>  struct globals {
 	const struct hwtype *hw; /* current hardware type */
 	const char *device;      /* current device */
 	smallint hw_set;         /* flag if hw-type was set (-H) */
-
 } FIX_ALIASING;
 #define G (*(struct globals*)&bb_common_bufsiz1)
 #define ap         (G.ap        )
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 0233ed8..b5120a7 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
 <at>  <at>  -1497,7 +1497,6  <at>  <at>  update_local_clock(peer_t *p)
 #endif
 		abs_offset = offset = 0;
 		set_new_values(STATE_SYNC, offset, recv_time);
-
 	} else { /* abs_offset <= STEP_THRESHOLD */

 		/* The ratio is calculated before jitter is updated to make
diff --git a/networking/tftp.c b/networking/tftp.c
index 7c0ee58..8ecd7bb 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
 <at>  <at>  -348,7 +348,6  <at>  <at>  static int tftp_protocol(
 			 * as if it is "block 0" */
 			block_nr = 0;
 		}
-
 	} else { /* tftp */
 		/* Open file (must be after changing user) */
 		local_fd = CMD_GET(option_mask32) ? STDOUT_FILENO : STDIN_FILENO;
diff --git a/networking/wget.c b/networking/wget.c
index 6c8bd90..f744ea2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
 <at>  <at>  -1050,7 +1050,6  <at>  <at>  However, in real world it was observed that some web servers

 		/* For HTTP, data is pumped over the same connection */
 		dfp = sfp;
-
 	} else {
 		/*
 		 *  FTP session
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 0173db9..c974c4a 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
 <at>  <at>  -251,7 +251,6  <at>  <at>  static int match(const char *name, struct stat *sb, char **con)
 			name = path;
 			if (excludeCtr > 0 && exclude(name))
 				goto err;
-
 		} else {
 			char *p;
 			p = realpath(name, path);
diff --git a/shell/ash.c b/shell/ash.c
index 282f761..4c01e67 100644
--- a/shell/ash.c
+++ b/shell/ash.c
 <at>  <at>  -9447,7 +9447,6  <at>  <at>  evalcommand(union node *cmd, int flags)
 		if (evalfun(cmdentry.u.func, argc, argv, flags))
 			goto raise;
 		break;
-
 	} /* switch */

  out:
 <at>  <at>  -11763,7 +11762,6  <at>  <at>  parsearith: {
 	goto parsearith_return;
 }
 #endif
-
 } /* end of readtoken */

 /*
diff --git a/shell/hush.c b/shell/hush.c
index 96c739f..3ca0449 100644
--- a/shell/hush.c
+++ b/shell/hush.c
 <at>  <at>  -5390,7 +5390,6  <at>  <at>  static NOINLINE int expand_vars_to_list(o_string *output, int n, char *arg)
 						!!(output->o_expflags & EXP_FLAG_ESC_GLOB_CHARS));
 			}
 			break;
-
 		} /* switch (char after <SPECIAL_VAR_SYMBOL>) */

 		if (val && val[0]) {
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 5729715..2b6f7dc 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
 <at>  <at>  -493,7 +493,6  <at>  <at>  shell_builtin_ulimit(char **argv)
 			/* bad option. getopt already complained. */
 			break;
 		}
-
 	} /* while (there are options) */

 	return 0;
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 266657f..156f487 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
 <at>  <at>  -237,7 +237,6  <at>  <at>  enum {
 	OPT_dup         = IF_FEATURE_SYSLOGD_DUP(   (1 << OPTBIT_dup        )) + 0,
 	OPT_cfg         = IF_FEATURE_SYSLOGD_CFG(   (1 << OPTBIT_cfg        )) + 0,
 	OPT_kmsg        = IF_FEATURE_KMSG_SYSLOG(   (1 << OPTBIT_kmsg       )) + 0,
-
 };
 #define OPTION_STR "m:nO:l:S" \
 	IF_FEATURE_ROTATE_LOGFILE("s:" ) \
--

-- 
1.7.1

Thanks ,
Maninder Singh
Natanael Copa | 9 Jun 13:06 2015

[PATCH] su: support denying accounts with blank password

Add a compile time option to disallow switching to an account with blank
password.

Signed-off-by: Natanael Copa <ncopa <at> alpinelinux.org>
---
A grep showed that all users of ask_and_check_password_extended
compared > 0 so this patch should not break anything.

 libbb/correct_password.c | 4 ++--
 loginutils/Config.src    | 5 +++++
 loginutils/su.c          | 3 +--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libbb/correct_password.c b/libbb/correct_password.c
index 513c930..afd307f 100644
--- a/libbb/correct_password.c
+++ b/libbb/correct_password.c
 <at>  <at>  -88,7 +88,7  <at>  <at>  int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext)

 
 /* Ask the user for a password.
- * Return 1 without asking if PW has an empty password.
+ * Return 2 without asking if PW has an empty password.
  * Return -1 on EOF, error while reading input, or timeout.
  * Return 1 if the user gives the correct password for entry PW,
  * 0 if not.
 <at>  <at>  -105,7 +105,7  <at>  <at>  int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,

 	pw_pass = get_passwd(pw, buffer);
 	if (!pw_pass[0]) /* empty password field? */
-		return 1;
+		return 2;

 	plaintext = bb_ask(STDIN_FILENO, timeout, prompt);
 	if (!plaintext) {
diff --git a/loginutils/Config.src b/loginutils/Config.src
index fa2b4f8..42b86ac 100644
--- a/loginutils/Config.src
+++ b/loginutils/Config.src
 <at>  <at>  -311,6 +311,11  <at>  <at>  config FEATURE_SU_CHECKS_SHELLS
 	depends on SU
 	default y

+config FEATURE_SU_DENY_EMPTY_PASSWD
+	bool "Enable su to deny empty passwords"
+	depends on SU
+	default n
+
 config SULOGIN
 	bool "sulogin"
 	default y
diff --git a/loginutils/su.c b/loginutils/su.c
index f812505..9cef3a6 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
 <at>  <at>  -92,8 +92,7  <at>  <at>  int su_main(int argc UNUSED_PARAM, char **argv)
 	}

 	pw = xgetpwnam(opt_username);
-
-	if (cur_uid == 0 || ask_and_check_password(pw) > 0) {
+	if (cur_uid == 0 || ask_and_check_password(pw) > (ENABLE_FEATURE_SU_DENY_EMPTY_PASSWD ? 1 : 0)) {
 		if (ENABLE_FEATURE_SU_SYSLOG)
 			syslog(LOG_NOTICE, "%c %s %s:%s",
 				'+', tty, old_user, opt_username);
--

-- 
2.4.2

Gmane