roadlabs / alt-f

Automatically exported from code.google.com/p/alt-f
0 stars 1 forks source link

A line feed is output mid-string on the "Users and Groups" page causing a JS error. This causes all groups to show "undefined" in the gname & usersInGroup fields #75

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

I've got a revision A1 DNS-323, and it works fine with both the 0.1RC1 and 
0.1RC2 firmware. However, I've noticed a problem in the "Users and Groups" 
setup page: a line feed character is being output mid-string, causing a JS 
error. This in turn causes all groups to show "undefined" in the gname & 
usersInGroup fields

What steps will reproduce the problem?
1. I do not know where the LF character comes from, so can't really give 
definitive steps to reproduce this. For example, it could be in your page code, 
or it may well have been erroneously added to one of the *nix config files by a 
package, etc. I will try and give you as much relevant information as possible 
anyway, in case it helps to diagnose / fix the issue.

I do know that I noticed this shortly before I flashed from 0.1RC1 to 0.1RC2, 
so it doesn't look like something that the new firmware has introduced.

Under 0.1RC1, I initially created two users and then deleted them again when I 
realised I only needed one, which I then created (called "media"). I created a 
new group (also called "media") and added the new user to it - which all seemed 
to work fine: when loading the "Users and Groups" page, I see the "media" user, 
and two groups (mine, and the default "users" group).

Clicking the "media" user in the left-hand select element shows "User name" as 
"media" and "Groups this user belongs to" as "users backup media" (even though 
I don't remember creating a "backup" group). However, clicking either the 
"users" or "media" groups in the right-hand select element populates both the 
"Group name" and "Users belonging to this group" field with "undefined".

There are two script elements containing relevant data being delivered by 
usersgroups.cgi, this one at line 235 (which is fine):

<script type="text/javascript"> ; users[0]="media"; groupsInUser[0]="users 
backup media"; </script>

And then this one broken up over lines 249 & 250:

<script type="text/javascript"> ; groups[0]="users"; usersInGroup[0]="sync, 
media, ";; groups[1]="media"; usersInGroup[1]=", 
media"; </script>

Due to the LF character, the string isn't being terminated on line 249, thus 
the JS error ("Unexpected token ILLEGAL") and "undefined" values.

My setup isn't that different from the out-of-the-box settings that came with 
0.1RC1: I added AppleTalk and the ipkg & forked-daapd packages, and disabled 
Samba (which the 0.1RC2 upgrade annoyingly re-enabled for me...), but that's 
about it.

The only other data I can think of that might possibly help is the contents of 
my /etc/group and /etc/passwd files, so here they are:

/etc/group:

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
ftp:x:7:
at:x:8:
backup:x:34:media
utmp:x:43:
sshd:x:67
#avahi 68
#multimedia 80
#network    81
netdev:x:82:
#nut 84 
nobody:x:98:
nogroup:x:99:
users:x:100:
media:x:101:media
avahi:x:68:
multimedia:x:80:

/etc/passwd:

root:x:0:0:root:/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:100:sync:/bin:/bin/sync
at:x:5:8:at Daemon:/home/at:/bin/sh
#dbus 6
ftp:x:7:7:FTP User:/var/run/vsftpd:/bin/sh
mail:x:8:8:mail:/var/spool/mail:/bin/sh
#cups 9
#ushare 10
#minidlna 11
#fuppes 12
#transmission 13
#mediatomb 14
#mt-daapd 15
#forked-daapd 16
#automatic 17
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
sshd:x:67:67:SSHD User:/var:/bin/sh
#avahi 68
#ups 69
nobody:x:99:98:nobody:/home:/bin/sh
media:x:1000:100:media:/home/media:/bin/sh
dbus:x:6:3:DBUS Daemon:/var/lib/dbus:/bin/false
avahi:x:68:68:avahi daemon:/var/run/avahi-daemon:/bin/false
daapd:x:16:80:forked-daapd user:/var/lib/daapd:/bin/false

Let me know if you want any more information from anywhere, and I'll post it 
ASAP.

Regards,

Dan

Original issue reported on code.google.com by d...@coedit.co.uk on 26 Feb 2012 at 2:26

GoogleCodeExporter commented 9 years ago
Thanks for the detailed report and the group/passwd files that allowed me to 
reproduce and (hopefully) solve the problem.

Fixed in svn now.

> even though I don't remember creating a "backup" group

Every created user is added to group 'backup' and 'users', and only groups 
whose gid is greater than 100 (and users whose id is greater than 1000) are 
displayed.

Original comment by whoami.j...@gmail.com on 28 Feb 2012 at 10:22

GoogleCodeExporter commented 9 years ago
I've just installed Alt-F ( 0.1RC2) and experiencing the same issue. See screen 
shot. Are there steps for me to remediate ? Thanks

Original comment by william....@gmail.com on 8 Aug 2012 at 1:46

Attachments:

GoogleCodeExporter commented 9 years ago
Try using the attached files to see if the problem is fixed.

Download them to the box /usr/www/cgi-bin directory and make sure they are 
executable.
If you have any Alt-F package (that provides a web page) installed, the files 
will survive a reboot.

The attached files has some changes not yet SVN commited.

Please report back.

Original comment by whoami.j...@gmail.com on 10 Aug 2012 at 10:44

Attachments:

GoogleCodeExporter commented 9 years ago
Just left town for a week's vacation. Will try when I get back and will update 
the thread. Thank for the message. 

Original comment by william....@gmail.com on 11 Aug 2012 at 4:49

GoogleCodeExporter commented 9 years ago
Those filess have solved the problem of the "undefined" value showing up in the 
group fields. see attached screen shot. Thank you!

Original comment by william....@gmail.com on 19 Aug 2012 at 3:34

Attachments: