cs.franklin.edu

Download Report

Transcript cs.franklin.edu

Week Six Agenda
•Announcements
•Link of the week
•Review week four lab assignment
•This week’s expected outcomes
•Next lab assignment
•Break-out problems
•Upcoming deadlines
•Questions and answers
Link of the week
http://en.wikipedia.org/wiki/Computer_security
This article describes how security can be achieved
through design and engineering
http://en.wikipedia.org/wiki/Secure_Computing
Firewalls, Safe Word authentication products, Internet
filtering products like Smart Filter, Bess, and
Webwasher
Link of the week
•
•
•
•
Define: Trusted System
Define: Trusted Computing
Where are trusted systems utilized?
How are trusted systems utilized?
Review week five lab assignment
Source
File
Source
File
Source
File
Source
File
Source
File
Object
File
Object
File
Object
File
Object
File
Object
File
Runtime
Library
Linker
Source/Object/Executable Drawing
Executable
Program
Review week five lab assignment
•
•
•
•
Define a makefile
Comments within a makefile (#)
makefile continuation lines (\)
Rule tells make both when and how to make a
file
• Dependency Line is a line with a colon (:)
test_build.sh contains the make command
which calls the makefile
• Demonstrate makefile script under
~dandrear/temp (Einstein)
Review week five lab assignment
What is the makefile utility used for?
Other software products that perform similar bundling operations
- ANT developed by Apache Jakarta
- ANT2 supplied from the Free Software
Foundation which is part of Red Hat.
What is a dependency between source files?
main.cpp  employee.cpp  address.cpp
What are the two parts of a dependency rule?
1) What files a file is dependent on
2) Rule that tells how to recompile the file
What are the differences between a makefile and a shell script?
The rules in a makefile are executed based on dependency, and
not sequential order. Scripts execute in sequential order.
Review week five lab assignment
Target : Dependencies (prerequisites)
<tab> Rule
prog:
a.o:
b.o:
c.o:
c.c:
a.o b.o c.o
g++ a.o b.o c.o -ly –o prog
prog.h a.c
g++ –c prog.h a.c
prog.h b.c
g++ –c prog.h b.c
c.c
g++ –c c.c
c.y
yacc c.y
mv y.tab.c c.c
Review week five lab assignment
Review week five lab assignment
myProgram
main.o
employee.h
main.cpp
employee.o
address.h
employee.cpp
address.o
address.cpp
Review week five lab assignment
Key Points About Makefile
1. Makefile recompiles all source files for a
project.
2. Makefile only recompiles files that have
been changed.
3. Bottom up control flow
4. Rules may be complex shell commands
Review week five lab assignment
Key Points About Perl
1. Dynamic typing
2. Dynamic allocation of memory for arrays
and hash tables
3. Both procedural and object oriented
programming capabilities
4. Rich third party software and use of
modules
Review week five lab assignment
• Regular expression (a.k.a. regex or regexp)
Is a pattern that describes a certain amount of
text. A basic regular expression could be the
single character, e.g.: a
Jane is a women.
It will match the first occurrence in the string.
If succeeding matches are desired, the regex
engine must be instructed to do so.
Review week five lab assignment
• Perl Hash table is an unordered set of scalars,
accessed by some string value that is associated with
each scalar.
%colormap=(
“12” => “gray”,
“19” => “black”,
“30” => “red”,);
%colormap = (“12”, “gray”, “19”, “black”, “30”,
“red”);
Review week five lab assignment
Hash Table
11
12
BLACK
13
RED
21
YELLOW
GRAY
22
23
BLUE
WHITE
31
32
33
GREEN
AMBER
GOLD
34
PINK
Week six expected outcomes
Upon successful completion of this module, the
student will be able to:
• Create makefile scripts for software programs.
• Use pattern rules in make files.
• Create an effective PowerPoint presentation.
• Create make files with multiple targets.
• Install software packages on a server.
Next lab assignment
Installing software under UNIX is not always
straightforward and easy. System
administrators must be familiar with the layout
of the file system. During a software
installation, the possibility exists that the
system could panic and/or have a hard disk
failure.
Next lab assignment
Installation Software Package Methods
Package manager
- What are the tasks of a package manager?
- The version of UNIX dictates which package
manager will be used.
- Many Linux versions utilize the Debian Package
Manager.
Manual
- The utilization of makefiles or shell scripts to
automate the install as much as possible.
- Many times the installation of software is done
by sending the source code to the site.
- What steps are required to install a new software
version?
- How is a “configure” script utilized?
Next lab assignment
Assignment number: 5-1 test scenarios
Command line: ./listdir.pl
Command line: ./listdir -l
Command line: ./listdir -l -d <directory>
Command line: ./listdir -d <directory>
Next Lab Assignment
$dirLoc="."; # Default to current working directory
for ($a=0;$a<=$#ARGV;$a++) {
# Verify that the option is a “d”
if ($ARGV[$a] eq “XXXX") {
$dir=1;
if (-d $ARGV[$XXXX]) {
# Assign the second argument (directory) to a variable
$dirLoc=$ARGV[$XXXX];
} else {
$errorDir=1;
}
# Verify that the option is a “l”
} elsif ($ARGV[$a] eq “XXXX") {
$long=1;
}
}
Next Lab Assignment
# Open the directory that was assigned to
# $dirLoc variable
opendir(XXXX, "$dirLoc") || die "Cannot open
directory.\n";
# Assign all file names to array
@unfiles=readdir(XXXX);
$z=1;
# Sort file names in ascending order
@files = sort { uc($a) cmp uc($b) } @XXXX;
Next Lab Assignment
foreach $file (@files) {
if (-f "$dirLoc/$file") {
if ($long) {
if ($z==1) {
printf("%-30s%10s%10s%10s\n","File
Name","Size","User","Group");
}
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
$atime, $mtime, $ctime, $blksize, $blocks) = stat
"$dirLoc/$file";
$group=getgrgid($gid);
$user=getpwuid($uid);
printf(“%30s%10.f%10s%10s\n”, $file,$size,$user,
$group);
printf("%30s%10.f%10s%10s\n",
$file,$siz e,$user,$group);
} elsif ($nolong) {
$printFiles.="$XXXX, ";
} else {
Next Lab Assignment
if ($z==1) {
printf("File Name\n");
}
print "$file\n";
}
$z++;
}
}
Next Lab Assignment
if ($nolong) {
chop($printFiles);
print "$printFiles\n";
}
closedir DIR;
Next Lab Assignment
Assembler
Kernel
Firmware
Hardware
Next lab assignment
• Demonstrate:
Execute Fall08_solutions/listdir.pl script
Break-out problems
•
•
•
•
•
•
•
touch command
dot command
dot dot command
What function does the makefile provide a project?
What are the two parts of a dependency rule?
What language is used for writing makefile rules?
What two methods are used for installing software
packages?
• What is a regular expression
• American National Standard Institute (ANSI)
Upcoming deadlines
• Mid-Term review (True/False, Multiple
choice)
• Mid-term exam dates 10/20 – 25/08.
• makefile Exercise, 6-1 is due 10/21/08.
Create the specified files referred to in Lab
Assignment 6-1.
• Programming Assignment 1, 5-1 is due
10/28/08.
• Installation Exercise, 8-1 is due 11/4/08.
Questions and answers
• Questions
• Comments
• Concerns
• Are there questions regarding the midterm outline?
• After class I will help students with their
scripts.