Skip to content

Commit

Permalink
Merge pull request #343 from cs136/staging
Browse files Browse the repository at this point in the history
Merge into stable (for release 2.5.0)
  • Loading branch information
e45lee committed Jun 19, 2015
2 parents 71f8976 + 11edc0c commit 9bc5b11
Show file tree
Hide file tree
Showing 57 changed files with 1,111 additions and 489 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ ELSE()
SET(GIT_DIRTY True)
ENDIF()

set(SEASHELL_VERSION "2.4.1")
set(SEASHELL_VERSION "2.5.0")
if(GIT_DIRTY)
set(GIT_COMMIT_HASH "${GIT_COMMIT_HASH}-dirty")
endif()
set(SEASHELL_API_VERSION "4")
set(SEASHELL_API_VERSION "5")

# Build our components.
add_subdirectory(doc)
Expand Down
47 changes: 47 additions & 0 deletions doc/developer/layout.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,52 @@ The following Seashell support components live here:

@subsection{Backend Server - @source-url-link["/src/collects"]}
@subsection{Fronted - @source-url-link["/src/frontend"]}
@bold{@larger{console.js:}}
@itemlist[@item["Console I/O"]
@item["ASAN Parsing"]]
@bold{@larger{file.js:}}
@itemlist[@item["Handles resizing of the window"]
@item["CodeMirror Options"]
@item["File History"]
@item["Hotkeys"]
@item["Running/Stopping/Testing Files"]]
@bold{@larger{project-list.js:}}
@itemlist[@item["Refreshes project list"]
@item["Checks for deletable"]
@item["New projects"]]
@bold{@larger{settings.js:}}
@itemlist[@item["Saving/Loading Settings"]
@item["Adding new Settings"]]
@bold{@larger{filter.js:}}
@itemlist[@item["Filter for the landing page"]
@item["Add new Regexp to sort in different ways"]]
@bold{@larger{modals.js:}}
@itemlist[@item["Handles all modals in the app"]
@item["Notable Modal is the Marmoset Results"]]
@bold{@larger{question.js:}}
@itemlist[@item["Controller for the question"]
@item["Handles Marmoset Results"]
@item["Marmoset Submit"]
@item["Updates most recently used project"]]
@bold{@larger{frontend.js:}}
@itemlist[@item["Controller for the frontend"]
@item["Help button function"]
@item["Archive function"]
@item["Logout function"]
@item["Settings function"]]
@bold{@larger{project.js:}}
@itemlist[@item["Controller for the project"]
@item["Most recently used info"]
@item["Creds Info"]]
@bold{@larger{routes.js:}}
@itemlist[@item["Refresh function"]
@item["Sets up paths and states"]]
@bold{@larger{Other Files:}}
@itemlist[@item["Directives.js"]
@item["errors.js"]]
@bold{@larger{includes directory:}}
@itemlist[@item["Add additional libraries here"]]
@bold{@larger{templates directory:}}
@itemlist[@item["HTML for the various pages"]]


12 changes: 12 additions & 0 deletions doc/release/2.5.0.scrbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#lang scribble/manual
@(require "../utils.rkt")

@seashell-title[#:tag "build-2.5.0"]{v.2.5.0}
Summary:
@itemlist[@item{Console and Seashell background color changes on theme change. @issue[139]}
@item{Better error handling on disconnects.}
@item{Better AddressSanatizer diagnostics.}
@item{Improved Stack Traces}
@item{Migrated to Angular 1.4.0}
@item{Login Reliability fixes}
@item{Developer documentation update}]
1 change: 1 addition & 0 deletions doc/release/main.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build pushed to live.

@include-section["2.4.1.scrbl"]
@include-section["2.4.0.scrbl"]
@include-section["2.5.0.scrbl"]
1 change: 1 addition & 0 deletions src/backend/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ target_link_libraries(seashell-clang clangFrontend clangFrontendTool clangCodeGe
clangSerialization clangDriver
clangTooling clangParse clangSema clangAnalysis
clangEdit clangAST clangLex clangBasic
clangStaticAnalyzerFrontend
${REQ_LLVM_LIBRARIES})
add_executable(seashell-test-clang driver.cc)
target_link_libraries(seashell-test-clang seashell-clang)
Expand Down
42 changes: 31 additions & 11 deletions src/backend/compiler/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "compiler.h"
#include <string>
#include <vector>
#include <set>
#include <tuple>
#include <memory>
#include <sstream>
#include <iostream>
Expand Down Expand Up @@ -55,7 +57,9 @@
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Frontend/Utils.h>
#include <clang/FrontendTool/Utils.h>
#include <clang/StaticAnalyzer/Frontend/FrontendActions.h>
#include <clang/Lex/Lexer.h>
#include <clang/Lex/Preprocessor.h>
#include <llvm/ADT/IntrusiveRefCntPtr.h>
#include <llvm/ADT/SmallString.h>
#include <llvm/ADT/Triple.h>
Expand Down Expand Up @@ -131,6 +135,10 @@ struct seashell_diag {
/** Location known? */
bool loc_known;
};
bool operator <(const seashell_diag& d1, const seashell_diag& d2) {
return std::tie(d1.error, d1.file, d1.mesg, d1.line, d1.col, d1.loc_known) <
std::tie(d2.error, d2.file, d2.mesg, d2.line, d2.col, d2.loc_known);
}

/** Seashell's compiler data structure.
* Opaque to Racket - make sure to pass a cleanup function
Expand Down Expand Up @@ -612,7 +620,7 @@ class SeashellDiagnosticClient : public clang::DiagnosticConsumer {
IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts;

public:
std::vector<seashell_diag> messages;
std::set<seashell_diag> messages;

SeashellDiagnosticClient(clang::DiagnosticOptions * diags) : DiagOpts(diags) { }
virtual ~SeashellDiagnosticClient() { }
Expand All @@ -628,7 +636,9 @@ class SeashellDiagnosticClient : public clang::DiagnosticConsumer {
const clang::SourceManager* SM = Info.hasSourceManager() ? &Info.getSourceManager() : nullptr;
const clang::SourceLocation Loc = Info.getLocation();
bool error = (Level == clang::DiagnosticsEngine::Error) || (Level == clang::DiagnosticsEngine::Fatal);

#ifndef _NDEBUG
fprintf(stderr, "Got diagnostic %s\n", OutStr.c_str());
#endif
if (SM) {
clang::PresumedLoc PLoc = SM->getPresumedLoc(Loc);

Expand All @@ -637,23 +647,23 @@ class SeashellDiagnosticClient : public clang::DiagnosticConsumer {
if( !FID.isInvalid()) {
const clang::FileEntry * FE = SM->getFileEntryForID(FID);
if(FE && FE->getName()) {
messages.push_back(seashell_diag(error, FE->getName(), OutStr.c_str()));
messages.insert(seashell_diag(error, FE->getName(), OutStr.c_str()));
return;
} else {
messages.push_back(seashell_diag(error, "?", OutStr.c_str()));
messages.insert(seashell_diag(error, "?", OutStr.c_str()));
return;
}
} else {
messages.push_back(seashell_diag(error, "?", OutStr.c_str()));
messages.insert(seashell_diag(error, "?", OutStr.c_str()));
return;
}
} else {
messages.push_back(seashell_diag(error, PLoc.getFilename(), OutStr.c_str(),
PLoc.getLine(), PLoc.getColumn()));
messages.insert(seashell_diag(error, PLoc.getFilename(), OutStr.c_str(),
PLoc.getLine(), PLoc.getColumn()));
return;
}
} else {
messages.push_back(seashell_diag(error, "?", OutStr.c_str()));
messages.insert(seashell_diag(error, "?", OutStr.c_str()));
}
}
};
Expand Down Expand Up @@ -879,8 +889,18 @@ static int compile_module (seashell_compiler* compiler,
Clang.getHeaderSearchOpts().AddPath("/include", clang::frontend::System, false, true);
#endif

clang::EmitLLVMOnlyAction Act(&compiler->context);
Success = Clang.ExecuteAction(Act);
/** Run the static analysis pass. */
clang::ento::AnalysisAction Analyze;
Success = Clang.ExecuteAction(Analyze);
if (!Success) {
PUSH_DIAGNOSTIC("libseashell-clang: clang::CompilerInstance::ExecuteAction(AnalysisAction) failed.");
std::copy(diag_client.messages.begin(), diag_client.messages.end(),
std::back_inserter(compile_messages));
return 1;
}

clang::EmitLLVMOnlyAction CodeGen(&compiler->context);
Success = Clang.ExecuteAction(CodeGen);
if (!Success) {
PUSH_DIAGNOSTIC("libseashell-clang: clang::CompilerInstance::ExecuteAction(EmitLLVMOnlyAction) failed.");
std::copy(diag_client.messages.begin(), diag_client.messages.end(),
Expand All @@ -892,7 +912,7 @@ static int compile_module (seashell_compiler* compiler,
std::copy(diag_client.messages.begin(), diag_client.messages.end(),
std::back_inserter(compile_messages));

std::unique_ptr<Module> mod(Act.takeModule());
std::unique_ptr<Module> mod(CodeGen.takeModule());
if (!mod) {
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/compiler/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ int main( int argc, char* argv[] ) {
printf("Build directory: %s.\n", BUILD_DIR);
printf("Debug build: %d.\n", SEASHELL_DEBUG);
printf("Is installed: %d.\n", IS_INSTALLED());
if (argc > 2) {
if (argc > 1) {
struct seashell_compiler* compiler = seashell_compiler_make();
seashell_compiler_add_file(compiler, argv[1]);
seashell_compiler_run(compiler);
Expand Down
4 changes: 4 additions & 0 deletions src/backend/user/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ int main() {
return 1;
}

#ifndef NDEBUG
putenv("PLTSTDERR=debug");
#endif

// Prefer build directory if debug build.
if(!IS_INSTALLED() && access(SEASHELL_DEBUG_MAIN, F_OK) != -1) {
char * argv2[] = {SEASHELL_DEBUG_MAIN, "-s", NULL};
Expand Down
23 changes: 19 additions & 4 deletions src/collects/seashell-config.rkt.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#lang racket
#lang racket/base
;; Seashell - a C Development Environment.
;; Copyright (C) 2013-2015 The Seashell Maintainers.
;;
Expand All @@ -16,7 +16,10 @@
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(require (only-in ffi/unsafe ffi-lib))
(require (only-in ffi/unsafe ffi-lib)
racket/contract
racket/path
racket/match)
(provide read-config config-set! config-refresh! SEASHELL_VERSION SEASHELL_BRANCH SEASHELL_COMMIT SEASHELL_API_VERSION
SEASHELL_BUILD_PATH SEASHELL_DEBUG SEASHELL_INSTALLED SEASHELL_INSTALL_PATH)

Expand Down Expand Up @@ -76,14 +79,14 @@
(cons 'seashell-support (let
([install-path (build-path SEASHELL_INSTALL_PATH "lib" "libseashell-support")]
[build-path (build-path SEASHELL_BUILD_PATH "src/backend/user/libseashell-support")])
(if (and (not SEASHELL_INSTALLED) (ffi-lib build-path #:fail (thunk #f)))
(if (and (not SEASHELL_INSTALLED) (ffi-lib build-path #:fail (lambda () #f)))
build-path
install-path)))
;; Location of Seashell clang library.
(cons 'seashell-clang (let
([install-path (build-path SEASHELL_INSTALL_PATH "lib" "libseashell-clang")]
[build-path (build-path SEASHELL_BUILD_PATH "src/backend/compiler/libseashell-clang")])
(if (and (not SEASHELL_INSTALLED) (ffi-lib build-path #:fail (thunk #f)))
(if (and (not SEASHELL_INSTALLED) (ffi-lib build-path #:fail (lambda () #f)))
build-path
install-path)))
;; Location of SSH known hosts file.
Expand Down Expand Up @@ -158,6 +161,18 @@
install-path)))

;; These flags can be overridden by the configuration file.
;; Default compiler flags.
(cons 'compiler-flags '(;; Warning flags.
"-Wall" "-Werror=int-conversion" "-Werror=int-to-pointer-cast" "-Werror=return-type"
;; Compilation flags.
"-gdwarf-4" "-O0" "-mdisable-fp-elim" "-dwarf-column-info"
;; Static Analyzer flags.
; Add standard static analyzer options (clang/lib/Driver/Tools.cpp:2954)
"-analyzer-store=region"
"-analyzer-opt-analyze-nested-blocks"
"-analyzer-eagerly-assume"
; Run all analysis passes. (clang -cc1 -analyzer-checker-help | awk '{print $1}' | grep -v '^[A-Z]' | awk -F. '{print $1}' | sort | uniq)
"-analyzer-checker=alpha,core,cplusplus,deadcode,osx,security,unix"))
;; Optional login tracking helper. (Runs whenever a user logs in.)
(cons 'login-tracking-helper #f)
;; Enable debug mode execution (corresponds to seashell-numeric-debug value by default)
Expand Down
17 changes: 10 additions & 7 deletions src/collects/seashell/backend/authenticate.rkt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#lang racket
#lang racket/base
;; Seashell's backend server.
;; Copyright (C) 2013-2015 The Seashell Maintainers.
;;
Expand All @@ -19,9 +19,12 @@
(require seashell/crypto
seashell/log
seashell/backend/project
json
racket/list
racket/serialize
net/base64
json)
racket/contract
racket/match
racket/port)
(provide exn:authenticate? authenticate install-server-key! make-nonce
make-authenticate-response make-download-token check-download-token
make-challenge make-file-upload-token check-upload-token)
Expand Down Expand Up @@ -83,7 +86,7 @@
;; Raises exn:authenticate if an error occurred.
(define/contract (authenticate token challenge)
(-> authenticate-token/c challenge/c void?)
(match-define `(,iv ,coded ,tag ,nonce) (map (curry apply bytes) token))
(match-define `(,iv ,coded ,tag ,nonce) (map (lambda (token) (apply bytes token)) token))
(define challenge-bytes (apply bytes challenge))

(with-handlers
Expand Down Expand Up @@ -129,7 +132,7 @@
(define-values
(iv coded tag)
(seashell-encrypt server-key
(with-output-to-bytes (thunk (write (serialize (list project
(with-output-to-bytes (lambda () (write (serialize (list project
(+ 60000 (current-milliseconds)))))))
#""))
(map bytes->list `(,iv ,coded ,tag)))
Expand All @@ -154,7 +157,7 @@
(map list->bytes token))
(define decrypted-token (seashell-decrypt server-key iv tag coded #""))
(define vals (with-input-from-bytes
decrypted-token (thunk (deserialize (read)))))
decrypted-token (lambda () (deserialize (read)))))
(if (and (project-name? (first vals))
(is-project? (first vals)))
(if (<= (current-milliseconds) (second vals))
Expand Down Expand Up @@ -203,7 +206,7 @@
(map list->bytes token))
(define decrypted-token (seashell-decrypt server-key iv tag coded #""))
(define vals (with-input-from-bytes
decrypted-token (thunk (deserialize (read)))))
decrypted-token (lambda () (deserialize (read)))))
(if (and (project-name? (first vals))
(is-project? (first vals)))
(if (<= (current-milliseconds) (third vals))
Expand Down
Loading

0 comments on commit 9bc5b11

Please sign in to comment.